diff options
author | webchick <webchick@24967.no-reply.drupal.org> | 2012-01-21 10:24:52 -0800 |
---|---|---|
committer | webchick <webchick@24967.no-reply.drupal.org> | 2012-01-21 10:24:52 -0800 |
commit | 138745688bcbed1a20b301ed616e5ed0796ecb5e (patch) | |
tree | 562afc5ec24a4cf5c58ec500c56f7d9c6014c6b0 /modules/system/system.api.php | |
parent | 4303ae6e48e140696e1a9c923bcdf913fa63c88d (diff) | |
download | brdo-138745688bcbed1a20b301ed616e5ed0796ecb5e.tar.gz brdo-138745688bcbed1a20b301ed616e5ed0796ecb5e.tar.bz2 |
Issue #800434 by pillarsdotnet, plach, bart.hanssens: Added drupal_mail(), allow hook_mail_alter() implementation to cancel mail.
Diffstat (limited to 'modules/system/system.api.php')
-rw-r--r-- | modules/system/system.api.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/system/system.api.php b/modules/system/system.api.php index a2e71d2cc..b2ae3192f 100644 --- a/modules/system/system.api.php +++ b/modules/system/system.api.php @@ -1903,11 +1903,19 @@ function hook_image_toolkits() { * - 'language': * The language object used to build the message before hook_mail_alter() * is invoked. + * - 'send': + * Set to FALSE to abort sending this email message. * * @see drupal_mail() */ function hook_mail_alter(&$message) { if ($message['id'] == 'modulename_messagekey') { + if (!example_notifications_optin($message['to'], $message['id'])) { + // If the recipient has opted to not receive such messages, cancel + // sending. + $message['send'] = FALSE; + return; + } $message['body'][] = "--\nMail sent out from " . variable_get('site_name', t('Drupal')); } } |