How to fix WordPress contact form which doesn’t send email

Yesterday I was sitting with my client in the Starbucks and chatting about programming and websites. The word WordPress popped up in  a conversation a couple of times as we were discussing content strategy. What’s funny – after a while a stranger approached me and asked how to fix a WordPress contact form which doesn’t send email. Actually, this seems to be a common issue, I was recently helping other clients with exactly the same problem on their sites.

Why does the problem exist?

Short answer – SPAM. Mail service providers are fighting junk mail with all possible means, and often that blocks messages from the contact form on your website for one of the following reasons

  • From field of the form is not setup properly
  • Server configuration is not perfectly correct
  • Shared hosting IP addresses often carry some bad reputation because of hacked sites used to send SPAM.

Let’s look at those issues and see what we can do about that. I will be using Contact Form 7 plugin in my illustrations, as it seems to be one of the most popular ones, so if you have a different plugin on your website, same ideas still apply, but you will need to search where the settings are.

From field of the form is not setup properly

Spam filters are checking the “From” field and validate domain setup for that address. Some domain names have so-called SPF or DMARC records setup, which basically a way for domain owner to restrict who can send emails using that domain address. If contact fills the form on your site and uses one of the domain names with those restrictions setup, it may get blocked and never reach your inbox.

Solution for this problem is pretty simple – use one of the address from your own domain name as a “From” email, and put contact’s email address in the “Reply-to” field. Using Reply-To header is a correct way to pass email address and make it easy for recipient to send response back to the contact with a Reply button of their mail application.

Here is a screenshot which shows how to do it with Contact Form 7 plugin (in WP Admin go to Contact section, then click edit on your form, then select Mail tab)

contact-7-not-delivering-email

Server configuration is not correct or hosting has bad reputation

Pretty often this happens on shared hosting accounts where hundreds of websites may be using the same email server to send outgoing email. It takes just one hacked account which sends some phishing scams from that server to have the outbound IP blacklisted and damage the delivery rates for all other hosting clients.

While you can contact hosting provider and try to sort things out with them, this is an uphill battle. Even if the current issue is resolved, it may come back a week later and you start it over again.

I suggest not to use standard mail delivery offered by your provider, but take control over this into your own hands by using external SMTP server. You can signup for free Mailgun account to use for your outbound mail, or, use your existing email account (setup an inbox for web form address, so you don’t interfere with regular mail).

After that, install Easy WP SMTP plugin and set it up to use your own outgoing email server (SMTP). Here is a sample screenshot of the setup (look for the settings page under WP Admin -> Settings -> Easy WP SMTP):

 

smtp

 

Don’t forget to test your setup!

Extra tip – have a copy stored

Even if your contact form is working perfectly, it’s a good idea to have a backup copy of all your form submissions stored somewhere on the server. So, if something goes wrong, you have a place where you can check past messages or look for missed form submissions.

I usually setup Contact Form DB plugin which stores a copy of all form submissions in the database and you can later browse data from the WP Admin.

Hope that helps to get your contact forms working again and let me know if you have any questions or need help!

Facebooktwitterredditlinkedinmail