In this post I’ll teach you how to keep your WordPress outgoing emails from being marked as spam when being received. Whether you own and maintain your own WordPress sites, or some for clients – this is probably one of the most helpful things you could learn (and I’ll tell you why).
Nearly everybody uses a shared web host for WordPress, and the most common big ones are Bluehost, Dreamhost, Hostgator, Godaddy. There are some smaller ones like Media Temple, but those 4 are the biggest 4 I commonly come across. The big hosts don’t just have thousands or tens of thousands of web sites, they have millions. Millions and millions. If you install WordPress, anytime mail is sent by it (for comments, a contact form, upgrade notification, etc.), it’s not actually sent “from” your domain. Let me explain.
If you have an email account, such as “email@example.com”, and you setup an email program to send and receive it has both an incoming and outgoing mailserver. When the mail gets sent out the “header” of the email states it was sent by firstname.lastname@example.org and it also says it was sent by and through that domain.
When WordPress sends an email it’s not the same. Let’s take a website hosted at Hostgator as an example. Let’s say your website is website.com and the email address you use is email@example.com, and that’s what your WordPress admin email is as well, and that’s also what you have the contact form submissions go to. When someone submits a contact form, many people won’t receive it because it will be labeled and marked as spam. I know this from experience.
Here’s an example:
I setup a simple contact form in WordPress, and it doesn’t really matter what the plugin is. I have used Contact Form 7, Gravity Forms, Really Simple Secure Contact Form, you name it – they all send the same. You can see that the email was sent from “Test Person” (name I used on the contact form) via gator3284.hostgator.com. I can see that gmail filtered this email as spam, but I still don’t know why. You have to actually view the email “header” to see why this happens.
In gmail click the down arrow to the right top in the body of the email like this:
go down to “show original”, and then you’ll get the email header. It has all the little technical details of how the email was sent and received.
In this picture we see the real reason the email failed. The sender was marked as @gmail.com, and the actual sender actually @hostgator.com. If you or your clients use a generic @gmail, @outlook, @hotmail, @yahoo email as the contact form recipient in WordPress, your emails will almost always go to spam. If they don’t you’re just plain lucky. Even if your website was website.com, and your contact form emails was firstname.lastname@example.org, since WordPress ultimate sends the outgoing mail from the generic mail server queue, the header would still list the sender as email@example.com (but really sent from @yourwebhost.com).
What I’m saying here is ultimately, with out of the box WordPress changes are high the outgoing email will be filtered (by at least some recipients) as spam. I have always had clients where I could not be ultimately sure that all of the outgoing website email would be received. For years I have solved this problem by installing a WordPress SMTP plugin (which generally worked fine). However, even some of the tried and true old standards have failed recently. This has led me to find a new solution.
I like the Postman plugin because it not only does what it says it’s going to do – it goes a step further. It has a smart setup wizard that detects the right settings for your web hosting and server configuration. It does all the hard work for you.
I skipped the first 2 sections, where you can import settings from another plugin, and the next tab where you enter your email address. I used a generic email address, and it automatically detected that I should be using smtp.gmail.com as my outgoing mail server.
Next Postman does a connectivity test (on the webserver), to figure out the best way to reliably connect to gmail and send email.
In the connectivity test section it automagically detected that I should be using SMTP – gmail.com:587, and the most secure method to connect is using OAuth 2.0 (using the gmail free API. don’t worry, this is not difficult).
Under Authentication, all you have to do is get your client ID and secret codes from the Google developers console Gmail wizard. Click the link for “How do I get a Google Client ID” to see a video of how to do this if you have any issues. It literally takes about 60 seconds.
After the “Finish” portion of the wizard, you will get one last prompt on your WP admin to “allow” WordPress to have access to send through your email. That’s really all you have to do, after that submit a contact form from your live site to verify that everything works properly.