Better WordPress Email Delivery
Forms coming from a shared server or even dedicated server will most likely be blocked, bounced, or marked as spam coming from an untrusted source. Unfortunately, most hosting packages come with an unreliable IP address. (Mostly from a shared IP address which is even worse)
To increase form delivery, the outgoing SMTP server needs to go through some sort of third party email service that has a higher reputation. I use Twillow SendGrid, but there are other resources like Mailgun, Sendinblue, Pepipost, ect…
SendGrid is free up to 100 emails per day. You could make each person their own account. For me, that gets a little messy and I’d rather not deal with having that many separate accounts. Most of my clients I host I keep in one Sendgrid account.
Setting Up SendGrid for WordPress
First you will need to download a plugin to handle the Sendgrid API. I use Post SMTP Mailer. You can just search for this in the WordPress Plugin Repository.
Once the plugin is installed and activated, navigate to the Post SMTP settings page.
Navigate to “Show All Settings” page.
In the first tab of the settings page, “Account,” we need to change “Type” to SendGrid API. “Mailer Type” will remain PostSMTP. The API Key section, we will need to setup a Sendgrid account.
Navigate to https://sendgrid.com and signup for a free account. Once signed in, go to settings, API keys.
In this section you can create an API key. Create a name for your API key. *NOTE: You can either use one Global API Key for all sites or setup API Keys for Individual sites. I tend to setup a key for each site, because it keeps me more organized*. You also have the options to give Full Access, Restricted Access, or Billing Access. We want to select “Restricted Access.”
In this section, give Full Access to API Keys, Email Testing, IP Management, Inbound Parse, Mail Send, Mail Settings, Sender Authentication, Tracking and User Account. Click the “Create & View” button to get your API Key.
*Important: Save the API Key somewhere safe. You will not be allowed to view the API Key again. If for some reason you lose the key, you can always just create a new key and delete this one. *
Now Back To WordPress
Copy and paste the API Key into the Authentication section of the Account tab in Post SMTP and save the changes.
Setting Default From Address
While still in the Post SMTP settings page, navigate to the Message tab. We want to make a default Email Address and Name in here that other plugins can’t change. This way, everything will be consistent and emails will send more regularly.
It is best to use an email address that is an actual email address. Using something like email@example.com could result in messages ending up in someone’s SPAM. You can do it this way, but it is safer to use an actual email address.
Name can be whatever you want the Email From Name to be and anything else on this page can just remain blank, unless you wish to setup the Additional Email Addresses. Though I usually leave those blank.
Testing the Connection
To test the connection, navigate back to the main Post SMTP settings page and find the “Send a Test Email” link. Enter in your own email address and make sure the message sends with success.
Making Sure the Email Doesn’t Reach The Spam Folder
For even better delivery, I recommend setting up Sendgrid Domain Authentication. It doesn’t 100% guarantee delivery, but it brings the success rate up over 90%. To setup Domain Authentication we have to go back over to Sendgrid!
Domain authentication will authenticate the domain with headers before the email is actually delivered. I usually see around 95% of emails go through when this extra setting is enabled.
Navigate back to your sendgrid account. Under settings you will see “Sender Authentication.”
Click on “Authenticate Your Domain.” I use Cloudflare for a lot of my sites, so I will show how to set this up using Cloudflare. Though, you can set this up with whatever company the domain is purchased through.
Select your DNS host. In my case it’s Cloudflare. “Would you also like to brand the links for this domain?” Select “Yes” for this option and click next.
On the next section enter the domain that you are sending from without the https://www. Just the domain. (Example: thisdomain.com) Then click next.
Entering in the CNAME Records
Next step is to enter in the CNAME records that appear on this page. This will link the domain to Sendgrid so the domain that is sending the email can be authenticated first, ensuring delivery. You will need to get into where the domain name was purchased (or in my case a CDN) to enter these records.
Copy and paste each one of the records that are generated for you, as a CNAME in your DNS.
Here is an example of one CNAME record I inserted for Sendgrid.
When all of the records have been added, verify the records, in Sendgrid, at the bottom of the “Install DNS Records” page. Records could take longer to verify depending on who the DNS host is. Godaddy may take longer.
Adding Records to Godaddy
I recently setup domain verification through godaddy’s DNS. For it to work with Godaddy, you need to remove the website name from all records. The above example would need name to be just em17774 not em1774.littlehouseweb.com. Do this for all records.
I would absolutely recommend checking your email delivery in Sendgrid at least once per week. Emails can get blocked, bounced, spammed. Sendgrid will keep track of this and it is a very useful thing to keep clients happy. View your activity in the “Activity” tab. If anyone has email delivery problems, it will give detailed descriptions of whom and what errors the email headers returned.