Hi all, i've got a custom nodetype module which works pretty well, but I want to send an email out to the user who creates a node of that type, and also to the site admin notifying him of the new node. I had a look through all of the modules and none of them seem to do this out of the box, is that the case or does anyone know of such a module?

Luckily, because the nodetypes in this case are my own modules, it wouldnt be a big problem for me to code it myself. I was thinking of doing it in node_insert() (I dont want to do it in node_submit because the users cant edit the node anyways, only the admin can, and if he does edit it, i dont want any notifications sent - only on the creation).

I couldnt find any info on a drupal mail api, except for some contrib modules, mime mail etc. Can I just use the standard php mail() function? Anyone more experienced than myself see any potential pitfalls in using php:mail() in the node_insert? or is there a better way?

many thanks in advance...

Comments

elfur’s picture

This sounds like the job for the Action module,
See for example an action snippet in the handbook that sends an email to everyone in a role group. I suggest you try modifying that to fit your needs.

/elfur.is

firstov’s picture

may be Notify module will do better. Setup the right permissions and modify settings under "my account"...
http://drupal.org/project/notify

high1memo’s picture

I'd already tried the Notify module, that seemed the most exciting, but it only seems to send the emails periodically, and every user has to manually subscribe. Whereas I want the email sent as soon as the new content is added, and the user should have no say in the matter, he should receive the confirmation email.

The Actions module had never occurred to me, I'll hava look at that thanks... though I don't need anything generic or customizable, just a simple fixed text email to the user who submitted the node, It might just be quicker to use the standard php mail() function in teh node_insert!!