Change Email Recipient Based on Field Value

Plugin Contributor
Lap

(@lapzor)

Yes! You can use field values in the Email To field.

For example, the To field can be [DEPARTMENT]@mc4wp.com

And then in the form you would have

<select name="DEPARTMENT" required id="department">
    <option value="" disabled selected hidden>Select</option>
    <option value="support">Support</option>
    <option value="admin">Administration</option>
  </select>

I do strongly recommend to not set the whole email address dynamically, as that would allow someone to send emails to arbitrary addresses via your site. That is why in the above example the domain is “hard coded” and only the part before the @ sign is dynamically set by the website visitor.

Hope that helps. If you have any questions, please let me know!

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer