Let's say i have a custom module in D7 , i want to add a feature to this .
the feature is : when a user publish a node send an email to someone .
function sending_email_node_update($node){
if (isset($node->original->status) && $node->original->status == 0 && $node->status == 1){
drupal_mail('sending_email','email_action','[email protected]',language_default());
}
}
function sending_mail_mail($key, &$message, $params) {
switch ($key){
case 'sending_email_node_update':
$message['subject'] = t('this is my action report');
$message['body'][] = t('this is a reporting from sending email made by soheil') ;
break;
}
}
Could you please help me how to do this ?
email_action
but in case statement you work withsending_email_node_update
. :)case 'sending_email_node_update':
tocase 'email_action':
and not work?