1

I cant seem to get the naming of the mimemail-message.tpl.php correct in Drupal 7. I know the naming scheme says "mimemail-message--[module]--[key].tpl.php" but either I'm not understanding what the brackets represent or I'm doing something else wrong.

I've tried:

mimemail-message--webform--mywebformname.tpl.php
mimemail-message--webform--250.tpl.php

Just mimemail-message.tpl.php works, but I need different template layout depending on which webform is used.

Also, is mime mail not supposed to make use of webform-mail-250.tpl.php at all?

1
  • i guess the [module] mean the module implement the hook_mail if you have any other module implements hook_mail [module] will be the machine name of this module instead of webform
    – berramou
    Oct 1, 2020 at 19:04

1 Answer 1

2

enter image description here

As you can see in line 264 of webform.submissions.inc Webform uses submission as the key.

Thus it needs to be named

mimemail-message--webform--submission.tpl.php

There is no way to target a specific webform without some extra custom code work.

mymodule.module

function mymodule_mail_alter(&$message) {
  if ($message['module'] == 'webform') {
    $nid = $message['params']['node']->nid;
    $message['key'] = $nid; // set key to nid
  }
}

Now you can do

mimemail-message--webform--250.tpl.php

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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