Route Contact Form 7 Submissions to Different Email Addresses by User Selection

When a website handles multiple departments or services, it is often necessary to route Contact Form 7 submissions to different email addresses depending on what the user selected. Fortunately CF7 supports this natively through its form tag syntax.

Problem: A Contact Form 7 form with a department or topic dropdown needs to route each submission to a different recipient email address depending on what the user selected.

Solution: Add a select field to the CF7 form, then use the wpcf7_before_send_mail hook to inspect the submitted value and override $mail['recipient'] with the appropriate address before the email is dispatched.

Step 1. Open the Contact Form editor, switch to the Form tab, and add a select element. The pipe character (|) separates the visible label from the value that gets sent as the recipient address. You can list multiple recipients for a single option by separating them with a comma:

[select* business-line class:form-control id:sel first_as_label
    "- Please Select -"
    "Sales Enquiries | sales@example.com, sales2@example.com"
    "Product Information | products@example.com"
    "Partnerships | partners@example.com"
    "Career Opportunities | hr@example.com"
    "Developer Program | dev@example.com"
    "Other | info@example.com"
]

Step 2. Switch to the Mail tab. In the To field, type the mail-tag that matches the select field name — in this example [business-line]. CF7 will automatically replace it with whichever email address the visitor selected.

If you also need to include the human-readable label (rather than the email address) in the email body, use the raw tag variant: [_raw_business-line]. This outputs the text before the pipe separator instead of the value after it.

NOTE: The pipe syntax works only with select, radio, and checkbox tags. If you need the same routing logic with a plain text field, you will have to handle it with the wpcf7_before_send_mail filter in PHP instead.