Contact Form 7 Multiple Recipients Tutorial

In some cases we want to create a contact form with multiple recipients; depending on the subject, the mail will be send to another recipient. In this article I’ll show you how you create this with the Contact Form 7 plugin.

Flexibility of the Contact Form 7 plugin

The Contact Form 7 plugin is one of the most popular plugins for creating forms in WordPress for the moment. I already wrote an article about this plugin which you can read here.

This plugin has a lot of options. The multiple recipients-option we want to create here is not a standard feature, but thanks to the flexibility of the plugin we can easily add this.

Adding a drop down list with multiple recipients

Introduction

What we want to create is a select field where our visitors will be able to select a department. Depending of the choice of our visitor, the mail will be sent to the right department.

In our example, we are going to build a select box with the following options:

  • Info -> [email protected]
  • Sales -> [email protected]
  • Helpdesk -> [email protected]

Adding a new multiple recipients select tag to the form

To create this, we are going to create a new (normal) select tag with these 3 options:

[select recipient "info" "sales" "helpdek"]

Okay, for now we have a normal select tag. But this isn’t connected with the different email-addresses yet. To do this, add “|” and the email-address. This will be the result:

[select recipient "info|[email protected]" "sales|[email protected]" "helpdek|[email protected]"]

Updating the mail “To:” address

Now, all we have to do is update the “To:” field:

multiple recipients

That’s it! Now the mail will be sent to the right department.

Conclusion

As you can see it’s very easy to extend the Contact Form 7 plugin. So if you want to create a contact form with multiple recipients, Contact Form 7 can do the job!

 

Related Posts

About Nico Julius

Nico is a teacher, developer and likes to share his ideas and vision on WordPressNinja.Com
  • dee

    how can i link from another site to the form an preselect a recipient?

    • Anonymous

      That’s a good question. I actually don’t know. If I had to do this, I should use JavaScript, but I’m not sure if this would work fine with the Contact Form 7 plugin.

  • Andrefy

    Hi, thanks for the tutorial very usefull,
    Is there a way a can sent different responses emails(the email content) according the dropdown selection?,

    • Anonymous

      Hi
      Thanx for your comment and sorry for the very late response. I actually don’t know (don’t think so, but correct me if I’m wrong)… In your case, I would code the whole form myself. Maybe you can ask this on the WordPress.org forums.
      Kind Regards,
      Nico

  • Hakan Daxberg

    what do i put in the subject field

  • Hakan Daxberg

    If I use your tip, Info|[email protected], is it possible to get Info in the subject field and the mail to the mailadress

    • Anonymous

      Hi Hakan,
      Sorry for the late answer. I’m on a trip in Vietnam / Cambodja, and I don’t have an internet connection every day…
      I think it’s not possible (but I’m not 100% sure) without some php coding.
      Maybe you can ask this question again here:
      http://wordpress.org/tags/contact-form-7?forum_id=10
      In this forum, the founder of the plugin also takes the time to answer questions. If it’s possible, he will be able to tell you how to fix this.
      Kind regards,
      Nico

  • dustin silva

    This is awesome, thanks for the help Nico!

  • edwins Psy

    This… Is.. AWESOME! works like a charm :)

    • http://www.wordpressninja.com Nico Julius

      Glad I could help!

  • Neesa Cambay

    Be grateful thank you so much for this post

    php web development