hook_mail_alter
hooks/core.php, line 1021
- Versions
- hooks
hook_mail_alter(&$message)
Alter any aspect of the emails sent by Drupal. You can use this hook to add a common site footer to all outgoing emails; add extra header fields and/or modify the mails sent out in any way. HTML-izing the outgoing mails is one possibility. See also drupal_mail().
Parameters
$message A structured array containing the message to be altered. Keys in this array include: id An id to identify the mail sent. Look into the module source codes for possible mail_id 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 An array of lines containing the 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).
Valor de retorno
None.
Código
<?php
function hook_mail_alter(&$message) {
if ($message['id'] == 'my_message') {
$message['body'] .= "\n\n--\nMail sent out from " . variable_get('sitename', t('Drupal'));
}
}
?> 
Comentarios recientes
hace 17 horas 50 mins
hace 1 día 10 horas
hace 1 semana 21 horas
hace 14 semanas 4 días
hace 19 semanas 19 horas
hace 20 semanas 2 días
hace 20 semanas 5 días
hace 20 semanas 5 días
hace 21 semanas 2 días
hace 22 semanas 1 día