0

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'] = 'example@example.com' 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 "example@example.com" 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?

0

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.

0

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.
0

I have done it using hook_mail_alter

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.