function protected_node_send_mail in Protected Node 7
Same name and namespace in other branches
- 6 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...
Parameters
object $node: A node object.
1 call to protected_node_send_mail()
- _protected_node_node_create_or_update in ./
protected_node.module - Helper function.
File
- ./
protected_node.mail.inc, line 17 - Protected Node mail handling.
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.'));
}