0

I was unable to get HTML mail to use a template properly, so I have a mymodule_mail function that sends emails when a response is required from the user

function billiondollar_mail($key, &$message, $params) {
global $base_url;

$message['headers'] = array(
    'MIME-Version' => '1.0',
    'Return-Path' => 'xx@xx.com',
    'Content-Type' => 'text/html; charset=UTF-8; format=flowed',
    'From' => 'XXXX <xx@xx.com>',
    'Content-Transfer-Encoding' => '8Bit',
    'X-Mailer' => 'Drupal'
);

I have a switch case on $key that loads in html header and footer plus the email body.

I'm wondering if there's some way I can make the system emails (some sent via trigger/actions and the registration confirmation ones) use that same system. Right now they are in plain text, which is incongruous with the rest of the system.

If I can get them using that hook function I will need to know what $key value it would have and how to insert the message content.. presumably one of the $params

1

I think this is what you're looking for:

http://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_mail_alter/7

"hook_mail_alter() allows modification of email messages created and sent with drupal_mail()... All core modules use drupal_mail() for messaging, it is best practice but not mandatory in contributed modules."

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.