I have a cck content type that essentially adds posts to a blog. The blog details administration site changes, upgrades, instructions and such for registered users to view. Sometimes I would like to send the title and body of a post of that type in an email to users with certain roles at the time I create it for the blog. I thought of adding 'send email' check boxes for certain roles in the content type form. Then if the content is saved and 'published' only, emails would be sent containing the title, body, and some notification message to all user/role checked boxes in the form. If the content was saved but not published no emails would be sent until status is published mode.

There are probably a number of ways of doing this. I thought of adding an action/trigger or rule, based on this content type etc. but am a little confused on how all this would be done. It might take some custom php to really get this to work. Like evaluating whether a new node of this type has been saved/published and whether any check boxes are a value of 1. Any suggestions or directions on a good way of accomplishing this task would be much appreciated. Thanks for taking the time to read this

Comments

CloudCuckoo’s picture

Definitely a job for triggers and actions. Instead of writing your own take a look at the rules module.

It provides conditional triggers, so you can set it up to trigger an action when a node is saved and is of a certain type. It also has a 'Send a mail to all users of a role' action.

I think you need to also have token module to configure the text of the email, I've never played with that bit.