Solved

WordPress Contact Form 7

Posted on 2015-01-15
26
356 Views
Last Modified: 2015-01-19
Using this plugin, is there a way to determine the email address sent to dynamically based on the selection in a pulldown field?

For example, look at http://rain1.com/new-site/about-us/get-a-quote/. Note the pulldown called Estimate Type.

We want to send the email to different addresses, based upon the value selected fro this pulldown.

Is that possible with this plugin or do I need a more sophisticated one?

Thanks
0
Comment
Question by:Richard Korts
  • 12
  • 11
  • 3
26 Comments
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40552881
You need a better plugin to do this.  Selecting recipients based on conditional logic is something that you usually find in the pro/paid plugins.  All of the good free ones (Contact Form 7, Ninja Forms, Formidable) can do a dynamic recipient assuming the email address is the value of the <select> box but chaining the recipient to another field's value appears to be reserved for the next level up. Contact Form 7 uses Pipes to do this:

http://contactform7.com/selectable-recipient-with-pipes/

Personally, I would use Gravity Forms for this but I have a developer's license for it so it's a sunk cost and it has more than paid for itself.  Formidable Pro is very affordable for a single site ($47) and rivals Gravity for usefulness, features, and support.  Ninja is the new kid on the block with an interesting business model - you buy modules as you need them - but to get it up to the level of Formidable or Gravity can get expensive.  It's the best of the breed for the free stuff, though.

One way to work around it is to send all quotes to a single email account and set up filters on that account to forward the message to the desired recipient based on the value.  That shouldn't be too tough to do.
0
 

Author Comment

by:Richard Korts
ID: 40553736
Jason,

I've never done the "filters" on an email account. Can you refer me to something that explains how to do that?

How do you pass the value to filter? With a query string attached to the jjones@xyz.com?

Thanks
0
 
LVL 7

Accepted Solution

by:
Alicia St Rose earned 250 total points
ID: 40554445
This can be done with Contact Form 7.

You just have to add it to the select code with pipes "|":

Here's an example I'm using on a site. There are different departments for a festival:

[select* recipient class: recipient "Administrative Office | info@blahblah.com"  "Art Department | art@blahblah.com" "Music Coordinator | spektrum@blahblah.com" "Marketing Department | marketing@blahblah.com"  "Production | production@blahblah.com"  "Merch Vending | vending@blahblah.com" "Food Vending | food@blahblah.com" "Workshops and Villages | metatron@blahblah.com" ]

Looks like this on front end:

Contact Form 7 select with different email addresses.
Contact Form 7 isn't as easy as the Premium plugins but with some research you can do just about anything with it.

There is a copious amount of info on the Plugin site:

http://contactform7.com/
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40554460
I've never done the "filters" on an email account. Can you refer me to something that explains how to do that?

Depends on your email provider or email program.  In Gmail, you can set filters to look for anything in a message and then take an action based on that setting.  Thunderbird (email program) and Outlook both have something similar.

--------------------------------------

laughhearty,

But does that method show "Administrative Office" anywhere or just use the selected email as the recipeint?  I'm thinking that in this specific case, the same person may receive multiple types of estimate requests but the form doesn't also show the label from the select box, it would get confusing.

If each item in the select had a different recipient, then this would work fine.
0
 

Author Comment

by:Richard Korts
ID: 40554541
To laughhearty,

If this works, that is great & saves a LOT of effort.

If some of the items in the dropdown DO NOT have a piped to email, does it use the "general" email on specified in the "To" box?

Or if one has one, do all have to?

Thanks
0
 
LVL 7

Expert Comment

by:Alicia St Rose
ID: 40554830
@Jason C Levine
Each item in dropdown has unique email. And I'm not sure that the subject can be piped in. In the case of the Festival crew, they assumed that if they got the email, then the person wanted to talk with them and chose the correct department from dropdown. Piping the subject would be nice though.

@rkorts
It's my guess that if you don't pipe in a different email, the default will be used. Or just add the email in the To box. It may be redundant, but never hurts to be accurate.
Test it.
0
 
LVL 7

Expert Comment

by:Alicia St Rose
ID: 40554831
@rkorts make sure you change the "To: " recipient in the form.
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40554890
And I'm not sure that the subject can be piped in.

Got it. Not expecting it to be able to do that, would have been awesome for a free plugin though.
0
 

Author Comment

by:Richard Korts
ID: 40558214
To laughhearty,

The method you suggested has been tested; does not seem to work. Following is the select in the Contact Form 7:

[select* EstimateType include_blank "Drainage Installation | jeff@rain1.com, blair@rain1.com" "Drainage Repairs | jeff@rain1.com, blair@rain1.com" "&#91;Installation&#93; Residential Sprinkler System | jeff@rain1.com, blair@rain1.com" "&#91;Installation&#93; Commercial Sprinkler System | kris@rain1.com, blair@rain1.com" "&#123;Service&#125; Residential Sprinkler System | customerservice@rain1.com" "&#123;Service&#125; Commercial Sprinkler System | customerservice@rain1.com" "Lawn Rejuvenation | jeff@rain1.com, blair@rain1.com" "Water Treatment | jeff@rain1.com, blair@rain1.com" "Sump Pumps & Backups" "Well Pumps Repair & Service"]</p>

A test was sent with Drainage Installation selected. The email was sent to the To: list (NOT the selected emails after the pipe) and where the select item is to be displayed in the email it has Estimate Type: jeff@rain1.com, blair@rain1.com. (Namely tghe emails after the pipe)

Any ideas?
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40558222
Did you map this field (EstimateType) into the recipient field of your form?
0
 

Author Comment

by:Richard Korts
ID: 40558312
Jason C. Levine,

I don't know what this means "Did you map this field (EstimateType) into the recipient field of your form?"
0
 
LVL 70

Assisted Solution

by:Jason C. Levine
Jason C. Levine earned 250 total points
ID: 40558319
You've created a piped select field named EstimateType where the labels are the type of estimate and the values are email addresses.  In order for Contact Form 7 to send to that address, you have to put the field name tag in the To: section of the email template

[EstimateType]
0
 

Author Comment

by:Richard Korts
ID: 40558340
Jason C. Levine,

You mean like the attached?

Thanks
Contact-Form.jpg
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40558347
Yes, except delete the space in the tag since there is no space in the code in this comment:

http://www.experts-exchange.com/Web_Development/Blogs/WordPress/Q_28597768.html#a40558214

and then delete all of the email addresses following the closing bracket.
0
 

Author Comment

by:Richard Korts
ID: 40558577
Jason C. Levine,

OK, I see. What this implies is that every item in the pulldown HAS to have an email address indicated after it. No problem, but I just want to make sure.

Does it matter if there are spaces before & after the pipe character? Like "Drainage Installation | jjones@jmail.com". Should there be spaces or not?

Also, if there is more than one address associates with a specific item, should they be comma separated with or without a space? Like "jjones@gmail.com, ssmith@aol.com".
Or no space?

Thanks
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40558642
What this implies is that every item in the pulldown HAS to have an email address indicated after it.

Yes.

Does it matter if there are spaces before & after the pipe character? Like "Drainage Installation | jjones@jmail.com". Should there be spaces or not?

No idea (I don't actually use this plugin).  The documentation page I posted way above shows no spaces.  When in doubt, make your stuff look like the documentation.
0
 

Author Comment

by:Richard Korts
ID: 40558710
To all,

In testing this, I get the following email:

GET A QUOTE FORM via Rain One Website

////////////////////////////////////////////////////////////////

From:
Richard Korts

Address:
866 Chardonney Way
Escondido, [data:us_subdivisions.states data:us_subdivisions.districts] 92029

Email address:
richardkorts@gmail.com

Phone:
760-489-1780

Best Time to Contact:
11 AM

Estimate Type:
richardkorts@gmail.com

Describe Your Project:
Test sent to me

How How Heard About Us:
Neighbor

--
This e-mail was sent from a contact form on Rain One, Inc. (http://rain1.com/)

Note the "Estimate Type" is the email address AFTER the pipe (|) character for that item in the dropdown.

See attached; this is how the email body is now constructed.

How do I get the actual dropdown item to appear as "Estimate Type" instead of the email address?

Thanks
MessageBody.jpg
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40558788
How do I get the actual dropdown item to appear as "Estimate Type" instead of the email address?

You probably don't.  That's what I was talking about in my very first post as well as in response to laughhearty's suggestion:

laughhearty,

But does that method show "Administrative Office" anywhere or just use the selected email as the recipeint?  I'm thinking that in this specific case, the same person may receive multiple types of estimate requests but the form doesn't also show the label from the select box, it would get confusing.

http://www.experts-exchange.com/Web_Development/Blogs/WordPress/Q_28597768.html#a40554445

-------------------------------------------------

This is the limitation of a free plugin.  You can have a dropdown that changes the recipient but that value gets replicated anywhere else you use its template tag.  This plugin is not written in a way where where you can choose to show the label in one area and the value in another.  To be fair, the label attribute of selects, radios, and check boxes is usually not dealt with by any form system, be it plain old PHP or a WordPress plugin.  It's text used to mask the true value.
0
 

Author Comment

by:Richard Korts
ID: 40558797
I looked at the docs as you suggested. It says "To get the value before the pipe, use [_raw_elementname]"; I'm testing that now.

Rkorts
0
 

Author Comment

by:Richard Korts
ID: 40558801
FYI, I would LOVE to do the whole thing in good old php, but they don't want to pay. They invested too much already in the prior WordPress developer.
0
 

Author Comment

by:Richard Korts
ID: 40558839
To all,

The syntax [_raw_elementname] works.

However, my problem now is that if there are multiple email addresses for a specific item in the dropdown, it fails & gives this message:

Failed to send your message. Please try later or contact the administrator by another method.

I tried it with the names separated by a comma and by comma, space. Neither works.

Any ideas?
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40558850
According to the plugin author, it should work:

https://wordpress.org/support/topic/plugin-contact-form-7-selectable-recipient-with-pipes-sending-to-multiple-recipients

But that thread was several years and who knows how many patches ago.  Does it work when you don't use the rawelement tag?
0
 

Author Comment

by:Richard Korts
ID: 40558866
To Jason C. Levine,

Nope, same thing.

I'm starting to think it's time to dump this approach.

Or maybe set up mail groups on the server? Then have the email address like "group1@rain1.com", etc.

Thanks
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40558878
That's how I would have done it (or filters on the server looking by subject and then forwarding automatically).

On the other hand, I do have Gravity Forms so this would not have been an issue for me.
0
 

Author Closing Comment

by:Richard Korts
ID: 40558883
A for effort; problem not solved.
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40559081
A for effort; problem not solved.

Begging to differ for the historical record.  I told you in my first post that a premium plugin is what was required for this and your experience bears that out.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Wordpress Horizontal Drop-Down Menu In this tutorial I will show you had to add a WordPress horizontal navigation menu to your theme. I have searched and searched for a good tutorial on creating a WordPress nav menu without adding a plug-in or us…
WordPress is constantly evolving, and with each evolution appears to get better and better.  One of the big drawbacks prior to version 3 was that there was no way to be able to set up a custom menu from the backend. The Old Way Adding menus is…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now