Confirmation Emails from Webforms

I would like to ask if there is a way to sent a confirmation email after the submission of a webform to more than one person. My webform has 4 fields to be filled with different or the same emails by the user. Hence, I would like to send a confirmation email to all of them plus to the person that submits the webform.
If I add a second email in the “Emails/Handler” then I have the problem of sending the notification email twice in the case that the user puts the same email 2 or more times in the webform. Can I prevent the system to sent to the same person the same confirmation email twice?

Dear Apostoli,

Yes it is possible. Go to your email handler and edit it. In the ‘To email’ under the SEND TO section select Custom To email address.

Now you can add all the email fields you have using tokens separated by commas.

The token should be [webform_submission:values:name_of_your_email_field] where name_of_your_email_field will be the field’s machine name in your webform.

So, if for example you have 3 fields email_1, email_2 and email_3 the value of the To email field should be:

[webform_submission:values:email_1], [webform_submission:values:email_2], [webform_submission:values:email_3]

You could also create additional email handlers with combinations of these fields using conditions so the system will use the correct handler if the required conditions are met.

For example you can have a handler to send an email to email_1 only when email_1 field has a value and the others fields don’t. You can have another handler sending emails to email_1 and email_2 only when these two fields have values and the other fields don’t etc.

You can leave conditional email handlers for now and try the first way I told you.

As for sending the email twice to a person, CERN’s email server will handle that and make sure one email is sent if the same email address is in the To: field. If you want to take measures for this to not happen in general you can use validation in the email fields so when the user enters the value is checked against the previous fields’ values and displays a warning if they are the same or prevent the user to submit the form.

1 Like

Thank you so much Sotiri. It works perfectly!