follow the steps in THEMING.TXT

- Open the Webform module directory.

- Copy (do not move!) the "webform-mail.tpl.php" file to your theme directory.

- Open up the new file and edit it to your liking. The webform-mail.tpl.php file
contains further instructions on how to get started with theming the e-mail.

I did modify the file just to make sure the custom template is used
I cleared cache
and submitted a form

the custom template contents don't appear in the email

what does it seem to be the problem ?

Comments

quicksketch’s picture

If following the steps, I can't see what's wrong with your approach here. It should work as you've described.

drupalstaff’s picture

quicksketch’s picture

Status: Active » Closed (fixed)

Closing after lack of activity.

jorgvloet’s picture

Version: 6.x-2.x-dev » 6.x-3.4
Category: support » bug
Priority: Normal » Major
Status: Closed (fixed) » Active

I have got the same problem, webform doesn't use the template file webform-mail.tpl.php. It doesn't even uses the file stored in the webform module directory (webform/templates/webform-mail.tpl).

in file webform.module on row 2083 I found this code:

if ($email['template'] == 'default') {
        $email['message'] = theme(array('webform_mail_' . $node->nid, 'webform_mail', 'webform_mail_message'), $node, $submission, $email);
      }
      else {
        $email['message'] = $email['template'];
      }

so I guess that when the var $email['template'] is "default" than the system is going to use the template file webform-mail.tpl.php or a custom one stored in theme directory.
But how I configure my webform, the var will never be default.

I've tried emptying the custom template field (under webform emails) and set the selectbox to default, nothing, setting the selectbox to custom, nothing happens.
I also saw that when I put some text to the textarea (so create a custom email trough the config of webform) than that text is put in the var $email['template'] but still no default.

this could be solved by putting "default" in the textarea, or directly in the database like I have read in http://drupal.org/node/961716 fixe by adeb, but I don't think that that’s the way to do this.

quicksketch’s picture

Category: bug » support
Priority: Major » Normal
Status: Active » Fixed

Hi jorgvloet. The 3.4 version has a bug in it that will cause the drop-down select list above e-mail templates to say "Default" even when it's not the default. Edit your e-mail configuration, change it to "Custom" then change it again back to "Default" (you should be asked a confirmation message to approve switching back to the default). Don't change the contents of the textarea at all.

This problem has been fixed already in CVS, I'll be putting out a 3.5 version that properly sets the template select list to "Default" when the default is actually being used.

jorgvloet’s picture

Hi quicksketch, thanks for your reply, I will be waiting for the release of 3.5

quicksketch’s picture

Note that a security release was pushed out last night that does NOT include the fix. It'll be in the 3.6 version now.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

vood002’s picture

Version: 6.x-3.4 » 7.x-3.18

I was unable to get the webform-email form to save with "Default" selected, it would always revert back to Custom.

Don't believe I was doing anything wrong.

I had to manually change the field in the database, then it worked for me.

Leaving closed in case I'm an idiot. Posting in case I'm not.

pale177’s picture

I had the same issue

Try copying the file in other Theme directories.

I was using the Garland theme for the website but the form was using the Seven theme. Took an hour to figure that out!

oriol_e9g’s picture

Issue summary: View changes

Yeah! Same problem.

Steps to reproduce:

  1. Copy webform-mail.tpl.php in your template
  2. Edit the webform-mail.tpl.php in your template
  3. Flush all caches
  4. Go to node/XXX/webform/emails/YYY and see that the default template included is main template, not the version in your theme
oriol_e9g’s picture

Version: 7.x-3.18 » 7.x-4.8
danchadwick’s picture

Version: 7.x-4.8 » 7.x-3.18

The template FILE is not visible there. That page shows the body of the message which goes into the template.

oriol_e9g’s picture

@DanChadwick I'm trying to say that in /modules/webform/templates/webform-mail.tpl.php you have the standard file content:

<?php print ($email['html'] ? '<p>' : '') . t('Submitted on [submission:date:long]'). ($email['html'] ? '</p>' : ''); ?>
<?php if ($user->uid): ?>
<?php print ($email['html'] ? '<p>' : '') . t('Submitted by user: [submission:user]') . ($email['html'] ? '</p>' : ''); ?>
<?php else: ?>
<?php print ($email['html'] ? '<p>' : '') . t('Submitted by anonymous user: [submission:ip-address]') . ($email['html'] ? '</p>' : ''); ?>
<?php endif; ?>
<?php print ($email['html'] ? '<p>' : '') . t('Submitted values are') . ':' . ($email['html'] ? '</p>' : ''); ?>
[submission:values]
<?php print ($email['html'] ? '<p>' : '') . t('The results of this submission may be viewed at:') . ($email['html'] ? '</p>' : '') ?>
<?php print ($email['html'] ? '<p>' : ''); ?>[submission:url]<?php print ($email['html'] ? '</p>' : ''); ?>

And if you copy&edit this file in: /themes/*your_theme*/templates/webform-mail.tpl.php with this new content:

<?php print "Hello, I'm a new template with values: [submission:values]."; ?>

When you visit node/*/webform/emails/* you expect to see in the textarea named "E-mail template":

Hello, I'm a new template with values: [submission:values].

But you encountered:

Submitted on [submission:date:long]
Submitted by user: [submission:user]
Submitted values are:
[submission:values]
The results of this submission may be viewed at:
[submission:url]

And when you submit a submission you are receiving the content defined in /modules/webform/templates/webform-mail.tpl.php not the version defined in your template: /themes/your_theme/templates/webform-mail.tpl.php

So, webform is ignorin the template defined in your theme... and, in my case, this problem is related in Webform 4.8.

danchadwick’s picture

The UI is a little confusing. By changing the theme template file, you are changing what the UI calls the Default template. I'm guessing that you have "Custom template" chosen, in which case Webform uses whatever is in the textarea.

If you are still confused, open a new issue, rather than continuing this in an old, unrelated closed issue.

alex.skrypnyk’s picture

The lookup for the template is performed in current theme, but current theme would most likely be some admin theme, which is not the theme that you are probably trying to put your template override file.