Closed (fixed)
Project:
Webform
Version:
6.x-2.6
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
13 May 2009 at 22:14 UTC
Updated:
12 Feb 2010 at 08:12 UTC
Is there any easy way I can theme the webform-mail.tpl.php so it sends different emails to submitter and "E-mail to addresses" in the webform settings?
Comments
Comment #1
quicksketchYes, read the documentation at the top of the webform-mail.tpl.php file. You can switch e-mails based on the $cid variable. The "E-mail to address" will have the $cid of 0.
Comment #2
tsvenson commentedThanks for your reply, but when I did a print on $cid it came out as "default" for the E-mail to address and 2 for the submitter...
Comment #3
quicksketchOh, shoot. Thanks. I thought it was "0", but "default" sounds correct. Just do IF statements based on $cid == 'default' to send different information to the separate e-mail addresses.
Comment #4
tsvenson commentedOki, should be no problem. As I got 2 for the submitter, can there be more values as well or can I assume that 2 is always used for the submitter?
Comment #5
quicksketch'2' is the Component ID for your webform's "email" component. If you set up multiple email components, each one would have a unique internal ID (the $cid). That way you could theme e-mails differently if one e-mail was for "Your e-mail" and another one was for "Your friend's e-mail" or something similar. The $cid will vary depending on what internal identifier each field was assigned upon creation.
Comment #6
tsvenson commentedThanks quicksketch, worked perfect.
I think it would be useful if you add the the header that to be able to insert line breaks they should be done so using "\r\n" for text emails and "<br>" for html emails in print strings.
Comment #7
dflitner commentedIs it possible to do something like if ($cid == email): ?
Our site uses a lot of webforms, and I was hoping to be able to send a generic confirmation email to the submitter that says "Thanks for submitting". However, I didn't want to make a webform-mail-nid.tpl file for each and every webform.
The email fields in most of the webforms are in a different location in the form, so each cid is a different number, I think. Is it possible to pull out the submitted email and use it in the cid if statement? Or is there another way to get a similar result?
I tried $form_values['submitted_tree']['email'] but it doesn't work. And printing that field just gives blank space.
Thanks for any suggestions.
Comment #8
quicksketchGenerally no. You can loop through all the node components and find which ones are of type e-mail, then do some action on it. Since this issue was opened support for custom theming is no longer provided in the Webform issue queue, so I'm closing this.