I have installed HTML Mail and Mail System modules and set them up with a template.. this is working fine when I send the test email it uses the template.
However when I send mail from my function, it doesn't use the template.. it was my understanding this should happen automatically, but how can I force it?
I have a mymodule_mail
function that just does a switch on $key and fills $message based on various types of messages the system sends.
I call it using drupal_mail().. and that's working, but not loading the template file.
So I added this line above where the mail is being dispatched:
mailsystem_set(array(mailsystem_default_id() => 'HTMLMailSystem'));
drupal_mail('mymodule', 'notification', $email, user_preferred_language($user), $params);
Then I tried moving the mailsystem_set to inside the mymodule_mail
function.
and it still isn't working. What am I missing??
drupal_mail has a module parameter that I'm using to call my own module that processes the different templates based on database calls etc. I'm wondering if I have to use that to call HTMLMailSystem, but I need to call my own first. (and still thought using the HTMLMailSystem would be the default)
hook_mail_alter()
function to modify the mail?htmlmail
instead ofmymodule
, it uses the template.. the trick is getting it to implement htmlmail via hook_mail_alter