July 23, 2008

Bulk view

Drupal: Adding a footer to all of your system e-mail

Drupal’s hook system is making me almost as happy as Emacs’ hook system does. =)

There’s a hook_mail_alter function that allows you to modify any message your system sends. Example:

function mymodule_mail_alter($mailkey, &$to, &$subject, &$body, &$from, &$headers) {
   $body .= "\n\n" . t('This is a system-generated email, please do not reply to this message');

You gotta love developers who plan for extensibility and put all sorts of hooks into the code…