Every time I use Contact Form 7 I fall for it. I commit the same error over and over again. I enter the wrong data for the from field on the mail tab. And every time it takes me precious time figuring out this silly error. And it is isn’t correctly told in the documentation either I am afraid. So let’s write it down here so we all remember how to properly configure the Contact Form 7 Mail From Field.
Form Data
Let’s say you create a standard form like so:
<label> Your Name (required) [text* your-name size:30 maxlength:60]</label> <label> Your Email (required) [email* your-email]</label> <label> Your Phone Number [tel your-tel "012345678"]</label> <label> Subject [text your-subject]</label> <label>Your Message [textarea your-message] </label> [submit "Send"]
Mail Tab Data
You also add all this data to the mail tab:
to:
jasper@ianua.dev
NB localhost domain
from:
[your-name][your-email]
subject:
iauna "[your-subject]"
additional headers:
Reply-To: [your-email]
message body:
From: [your-name] <[your-email]> Subject: [your-subject] Message Body: [your-message] -- This e-mail was sent from a contact form on Iauna (//localhost:3000/ianua/site/web)
You check all and see all is well. Well, you think..
Configuration Error Found
Then you save the form and see:
What? So you go to Contact Form 7 Documentation to resolve configuration errors and see nothing that is wrong. Zilch! So you check all again. You decide to go to the mail tab and you see:
Solution
But…but the your-email tag should load the email address of the client right? It says so here in the documentation that you can. Nope. It is the one connected to the domain. It should be the email address you use to send email to clients. As DavidFB said here:
On the Form, [your-email] is the form fillers address.
On the Mail tab, the settings are for Routing the mail. To is who you want the form data to go to and From is the address SENDing the form data. In this case, it’s not actually the person sending, it’s the web site. So From should match the server domain so it’s not seen by mail servers as spoofing or relaying.
So what you need to add is:
Company Name<name@domain.tld>
After that all will be well. Emails will be sent properly and clients will be happy. Let’s hope we can all avoid this mistake the next time!
Bonus
Do not forget to add the additional headers:
Reply-To: [your-email]
This will make it loads easier to reply to clients when they email you. Saves you time copying their address from the body of the email!
Thanks for sharing this Guide.