function protected_node_send_mail in Protected Node 6
Same name and namespace in other branches
- 7 protected_node.mail.inc \protected_node_send_mail()
- 1.0.x protected_node.mail.inc \protected_node_send_mail()
Protected node sends email to specified users.
@todo We should properly handle the language...
1 call to protected_node_send_mail()
- protected_node_nodeapi in ./
protected_node.module - Implementation of hook_nodeapi(). @link http://api.drupal.org/api/function/hook_nodeapi/6
File
- ./
protected_node.mail.inc, line 14
Code
function protected_node_send_mail($node) {
module_load_include('settings.inc', 'protected_node');
$body = variable_get('protected_node_email_body', protected_node_email_body());
if (strpos('[node-password]', $body) !== FALSE) {
if (empty($node->protected_node_clear_passwd)) {
drupal_set_message(t('The protected node email was not sent because the [node-password] is undefined. You must re-enter the password before saving in order to send the password.'), 'error');
return;
}
}
$from = variable_get('protected_node_email_from', '');
if (!$from) {
// needs to be null to work properly inside drupal_mail()
$from = NULL;
}
drupal_mail('protected_node', 'password', $node->protected_node_emails, 'en', array(
'node' => $node,
), $from, TRUE);
drupal_set_message(t('The email about this page was sent to the specified email addresses.'));
}