I need to have a bunch of different webform e-mail templates with different text - how do I create those with code in Drupal 7?


Ok, I got this sorted out, I used hook_form_alter to get the stuff into the select field, and did an override on the javascript-file from the webform module. I will try to answer it more complety in the next days if I have the time to do so.

  • Any info you can give on this would be great; we're trying to do the exact same thing. – Mike Feb 22 '17 at 19:11

Webform emails are themeable using .tpl.php files just as nodes, views etc. There is a THEMING.txt document that ships with Webform that explains exactly how to do what you are after, although the bit you're looking for is near the top:

If you want to edit the e-mail sent by only one particular webform, rename the file "webform-mail-[node id here].tpl.php", replacing [node id here] with the node ID of the webform.

There's also this handbook page on Drupal.org: Customising the emails sent by webform

  • No, that is not my need - I want to have my own e-mail templates - like the default and custom one - not a tpl file, with predefined text. – MiSc Aug 14 '13 at 9:00
  • Ah, so you want to add your own options to that list? E.g. Default, Custom, MiSc 1, MiSc 2? – Chapabu Aug 14 '13 at 9:04
  • Yes, that is what I would like to have. – MiSc Aug 14 '13 at 10:47

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.