Reading the docs I can see that you can conditionally change the recipient of a webform email based on a field value, but that's not quite what I want to do. I want to modify the content of the message based on a form input. For example, based on a webform field like:

Favorite Color: [] Blue [] Yellow [] Red

Upon submission the user should receive totally different email messages saying either:

You probably like the sky...


You probably like bananas...

etc. (you get the idea).

Note: it would be clever and would solve this minimalistic example to create the options like

the sky|Blue

and then use their tokens, but that's not an option in this case as it's multiple paragraphs of text I want to be different in the conditional messages.


3 Answers 3


This is more of a coding solution but you could implement hook_webform_submission_presave() in a custom module and use that to save the appropriate text to a hidden webform field type, then see if the token for that field will work in the email.

Alternatively, you could implement hook_webform_submission_insert() and send the email programmatically there, which would give you full conditional control of the email recipients and contents.


I haven't tried this, but looking to do the same I hope to go with


That is, write your own webform-mail-[nid].tpl.php and have php logic there.


in drupal 8 it can be set in the handlers parameters


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.