hook_mail_alter
developer/hooks/core.php, строка 698
- Версии
- 5
hook_mail_alter(&
$mailkey, &$to, &$subject, &$body, &$from, &$headers)- 6
hook_mail_alter(&$message)
Изменяет любой аспект email отсылаемых Друпал. Вы можете использовать этот хук, чтобы добавить общий нижний колонтитул сайта для всех исходящих писем; добавить дополнительное поле заголовка и/или изменить отправляемые письма любым образом. HTML-изация исходящих писем - одна из возможностей. Смотри также drupal_mail()
.
Параметры
$mailkey
A key to indetify the mail sent. Look into the module source codes
for possible mailkey values.
$to
The mail address or addresses where the message will be send to. The
formatting of this string must comply with RFC 2822.
$subject
Subject of the e-mail to be sent. This must not contain any newline
characters, or the mail may not be sent properly.
$body
Message to be sent. Drupal will format the correct line endings for you.
$from
The From, Reply-To, Return-Path and Error-To headers in $headers
are already set to this value (if given).
$headers
Associative array containing the headers to add. This is typically
used to add extra headers (From, Cc, and Bcc).
Возвращаемое значение
The return value is discarded. Modify the parameters directly.
Связанные темы
Код
<?php
function hook_mail_alter(&$mailkey, &$to, &$subject, &$body, &$from, &$headers) {
$body .= "\n\n--\nMail sent out from " . variable_get('sitename', t('Drupal'));
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии