Hướng dẫn gửi email dựa trên select option trong Contact Form 7

Written by Tommy
Posted on Wed, 07/28/2021 - 11:09

Share Everywhere

Table of contents

Chúng tôi sẽ hướng dẫn bạn cách gửi email cho những người khác nhau dựa trên lựa chọn thả xuống trên Biểu mẫu liên hệ 7 trong Wordpress.

Chúng tôi muốn làm gì?

Giả sử rằng bạn là chủ sở hữu của một công ty có uy tín. Công ty của bạn có các văn phòng / phòng ban khác nhau ở các thành phố khác nhau.

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

Create dropdown with options “Administrator”, “Support”, “Technical” and “Sales” in Contact Form 7 as following:

[select your-recipient "Administrator"

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]"]
Hướng dẫn gửi email dựa trên select option trong Contact Form 7
Hướng dẫn gửi email dựa trên select option trong Contact Form 7

Selectable Recipient Dropdown Contact Form 7

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.

Don’t take a tension about invalid mailbox syntax.

Selectable Recipient Contact form 7 To Field

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.

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
4 + 16 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.
Profile picture for user Tommy
Câu nói tâm đắc: “Điều tuyệt với nhất trong cuộc sống là làm được những việc mà người khác tin là không thể!”