1. Home
  2. Docs
  3. FAQ
  4. Can I send the form to different email addresses based on the selection?

Can I send the form to different email addresses based on the selection?

There are 2 ways to do this.

1. Without conditional logic.

Let’s say you have a drop down list like this:

[select your-recipient "CEO" "Sales" "Support"]

You can then assign the corresponding e-mail address as a hidden value to each of the corresponding options.

In Contact Form 7, a pipe (‘|’) can be used to assign a hidden value to an option in a drop-down list. For example:

[select your-recipient "CEO|ceo@example.com"
                       "Sales|sales@example.com"
                       "Support|support@example.com"]

If you insert a pipe (‘|’) character in the middle of the option value, only the part before the pipe will be open to the outside, and the part after the pipe will be used for mail replacement.

As a last step, simply add this in the TO-field:

[your-recipient]

Source: Selectable Recipient with Pipes

2. With conditional logic.

Let’s say your drop-down (or any other field) reveals a group, based on the selection.

[select your-recipient "CEO" "Sales" "Support"]
[group ceo-group]Your mail will be sent to the CEO[/group]
[group sales-group]Your mail will be sent to the Sales department[/group]
[group support-group]Your mail will be sent to Support[/group]

Conditions:

Show [ceo-group] if [your-recipient] equals "CEO"
Show [sales-group] if [your-recipient] equals "Sales"
Show [support-group] if [your-recipient] equals "Support"

In the To-Field, you can add:

[ceo-group]ceo@example.com[/ceo-group][sales-group]sales@example.com[/sales-group][support-group]support@example.com[/support-group]
Tags
Was this article helpful to you? Yes 2 No