2 * Implements hook_mail_alter().
4 function {{ machine_name }}_mail_alter(&$message) {
5 if ($message['id'] == 'modulename_messagekey') {
6 if (!example_notifications_optin($message['to'], $message['id'])) {
7 // If the recipient has opted to not receive such messages, cancel
9 $message['send'] = FALSE;
12 $message['body'][] = "--\nMail sent out from " . variable_get('site_name', t('Drupal'));