Customizing a Webform E-mail Template

The e-mail template field uses strings of characters and text, called tokens, to determine what information will be included in the e-mail that will be distributed upon submission of the Webform.  These tokens are very powerful tools because they allow for a single e-mail template to use elements from your Webform to customize each email.  This way every e-mail can be tailored to the individual that it is sent to.


Click on the words "Token values" to see the available token values.


Screenshot of the opened Token values fieldset.


Because using these tokens can be a little confusing, here are a few different examples of how to use the tokens.  Each field has it's own unique field key, which is used by the tokens to differentiate between all of your different fields.  For this example we will assume that I have a field whose title is "E-mail".  The key for this field is "email", and the person submitting the Webform has entered johndoe123@oregonstate.edu as their e-mail address.


If you put this in the template field:


then you will have this returned:

E-mail: johndoe123@oregonstate.edu


Or if you entered:

Email: %value[email]

then the following would be returned:

Email: johndoe123@oregonstate.edu


The difference between these two entries is that when you use the %email[key] token you get what Drupal calls a formatted value, while you only are given the value of the field when you use the %value[key] token.  The formatting refers to how Webform adds the title of the field followed by a colon and space before the value of the field.  This way you can have things atomated to show their title the %email[key] token.  Or, now you have the option to do something like put a person's name in the middle of a sentence with the %value[key] token.