Home ยป Send Emails to Different People Based on Dropdown Selection: Contact Form 7

Send Emails to Different People Based on Dropdown Selection: Contact Form 7

Last updated on June 11, 2020 by

In this article, we will teach you how to send emails to different people based on dropdown selection on Contact Form 7. Let’s first understand what we wanted to achieve?

What we want to do?

Assume that you are the owner of a reputed company. Your company has different offices/departments in different cities.

So you want to submit all queries to the relevant office/department. Let’s say you have “Administrator”, “Support”, “Technical” and “Sales” department.

Now, Let’s set up a Contact Form 7 in a way so you will receive emails on above mentioned offices/departments.

Selectable Recipient in Contact Form 7

  1. Create dropdown with options “Administrator”, “Support”, “Technical” and “Sales” in Contact Form 7 as following:
[select your-recipient "Administrator"
                       "Support"
                       "Technical"
                       "Sales"]
  1. Now, add email addresses as a value to each option using pipe (|) sign.
[select your-recipient "Administrator|[email protected]"
                       "Support|[email protected]"
                       "Technical|[email protected]"
                       "Sales|[email protected]"]
Selectable Recipient Dropdown Contact Form 7
  1. Go to the “Mail” tab and set the mail tag "[your-recipient]" into the To: field. This setting ensures that the email is sent to the specified email address that the sender selected. Don’t take a tension about invalid mailbox syntax.
Selectable Recipient Contact form 7 To Field
  1. We are done now. Try to submit 2-3 mails by selecting a different dropdown option. Make sure that your mail sending mechanism working. If not then install any simple SMTP plugin to make it work.

Additional Information

To get the value before pipe (|) sign use [your-recipient] as we already did in To: field of Mail tab.

To get the value after pipe (|) sign use [_raw_{field name}]. In our case, {field name} is your-recipient. So finally, it will be [_raw_your-recipient]. This can be handy in the Message body.

That’s it for now. We hope this post helps you to learn how to send emails to different people based on dropdown selection in Contact Form 7.

If you have any issues then checkout our guide: Contact Form 7 is not Working Issue in WordPress.

Please let us know in the comments if everything worked as expected, your issues or any questions. If you think this article saved your time & money, please do comment, share, like & subscribe. Thank you for reading this post ๐Ÿ™‚ Keep Smiling! Happy Coding!

 
 

Leave a Comment