forked from a64f7bb4-7358-4778-9fbe-3b882c34cc1d/v1
15 lines
463 B
Twig
15 lines
463 B
Twig
/**
|
|
* Implements hook_mail_alter().
|
|
*/
|
|
function {{ machine_name }}_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 " . \Drupal::config('system.site')->get('name');
|
|
}
|
|
}
|