I have overridden the webform mail(webform-mail-19.tpl.php) template in my theme. The problem is I want to set the recipient in this template file so I used this code. $email['email'] = '[email protected]' but it did not send email to this address instead it sends email to the email address which i setup in the email settings of the webform.

I print the $email array and I could see "[email protected]" email there but did not know why it sends the email to the default email address which is setup at the email settings of the webform.

Any Idea about this?

3 Answers 3


You cannot set the recipient in a template file, these files are only used for the theme layer. The templates only control the display of information.

The recipient email must be set on the settings page of the webform.


You can implement following step for the mail setting.

  • Add a hidden component in the webform.
  • In the webform mail setting page, you can set hidden component as mail to address.
  • You can override the value of hidden component in webform mail template.

I have done it using hook_mail_alter

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.