Skip to content

Instantly share code, notes, and snippets.

@evolvingweb
Created March 30, 2012 03:16
Show Gist options
  • Save evolvingweb/2246159 to your computer and use it in GitHub Desktop.
Save evolvingweb/2246159 to your computer and use it in GitHub Desktop.
hook_node_insert()
<?php
/*
* Implements hook_node_insert()
*
* Sends an email when a node is added
*/
function mail_node_insert($node) {
if ($node->type == "blog") {
mail('info@example.com', 'Blog Updated',
'Link: http://example.com/node/' . $node->nid);
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment