Properly configuring email forms is not always simple. Contact Form 7 is the most popular WordPress form plugin and, as of version 4.4, an automatic Configuration Validator function was introduced to try and prevent email configuration issues.
For the most part, the Validator is straightforward, but there are two validation issues in particular which have confused a lot of people:
- The From email field
- The Subject line field
This tutorial is designed to clear up those issues.
If you’ve never run the Contact Form 7 Validator, you’ll see this message until you do:
Clicking on that link brings you to a new screen where you actually start the validation process by clicking Validate Contact Forms Now:
Once the plugin has finished checking the forms, you’re taken to the Contact Form 7 page that lists all your forms. The ones with issues will continue to show the error message here until you fix them:
There are a number of possible configuration errors, and these are clearly outlined at the Contact Form 7 website, but I want to focus on the two I see people having the most trouble with.
The From Email Field
As the author of Contact Form 7 points out, email security has become a major focus of hosting companies and email services over the last couple of years. One of the key measures they’ve taken is to reject email in which the domain name in the From field does not match the domain from which the email was sent.
When Gmail, for example, refuses to accept an email from the contact form on your website because the domain name doesn’t match, your first reaction might be: but the email form is on my domain, so why wouldn’t the domain name in the email match?
However, there’s a sense in which the email is NOT coming from you and your domain, it’s coming from the person who filled out the form. Another way to think of it is this: you want to be able to reply to the person who sent the email, not reply to yourself and your domain, so the email needs to be seen as coming from that other person.
For years, Contact Form 7 users have simply put the shortcode used to gather the visitor’s email address into the From field of the form settings, as shown here (the default shortcode is [your-email] but it could be something else):
For years, this set up worked just fine. In fact it still can in some circumstances. But more and more servers – Gmail most notably – will reject emails set up like this.
The fix is simple: put an email address in the From field that has your domain name in it, then put the sender’s email address into the Additional Headers field with “Reply To” in front of it.
If you forget the Additional Headers step, when you hit Reply in your email program, it will go to whatever address you put in the From field. In other words, it will just go to yourself!
The Subject Line Field
Validation issues with the subject line in Contact Form 7 have been particularly confusing to people until more recent versions of the plugin contained a clearer error message.
The issue here is: the subject line cannot be blank. While it’s true that there’s a shortcode in there, which fills in whatever the visitor has put as their subject, what the error message is saying is that it’s possible the visitor won’t fill in the subject line, so you’ll be left with a blank.
There are two ways to solve this:
My preferred way is to put something in the subject line in addition to the subject shortcode:
That way, if someone decides not to put anything in the subject field, you’ve still got something in there and it will tell you quickly, when you’re sifting through all your emails, where it’s been sent from.
As a matter of fact, I rarely put the subject field in basic contact forms. It’s just another field for visitors to fill in and I like to keep those forms as short as possible. In that case, I don’t even have the shortcode in the form settings.
Another option, if you do want a subject line, is to make it required. That way, you know the shortcode will always put something into the Subject field, and the error won’t occur. To make a field required in Contact Form 7, you simply put an asterisk next to the field type:
The Contact Form 7 Validator will see that this is a required field, and so it won’t generate a configuration error message if all you have in the Subject field is the shortcode.