Would you like a reliable, secure email delivery solution that works with a variety of email addresses? In this tutorial, we’ll walk you through how to set up WordPress email notifications with SendGrid using WP Mail SMTP.
- What is SendGrid?
- Configuring Your SendGrid Account
- Setting Up WP Mail SMTP
- Verifing SendGrid Integration
- Authenticating Your Domain
- Sending a Test Email
What is SendGrid?
SendGrid is a popular method of improving email delivery. They do this through an API, which provides a more secure method than traditional SMTP. Further, they offer both free and paid options depending on the number of emails you need to send each month.
SendGrid’s free plan allows your site to send up to 40,000 emails for your first 30 days, then 100 emails per day after that. For most small businesses and personal websites, that’s plenty. If you need to send more emails, though, you will likely need one of their paid plans.
In order to use SendGrid effectively, you will need to have an email address associated with a domain that you own (emails that are @gmail.com, @yahoo.com, etc are not recommended for use with this mailer).
1. Configuring Your SendGrid Account
In order to connect your website with SendGrid, you’ll first need to set up a SendGrid account and getting the API key. This key is a unique identifier for authentication that will allow your website to communicate with your account in SendGrid.
If you haven’t already, you’ll need to sign up for a SendGrid account by visiting their Pricing page. From here, you can choose the account type that fits your site’s needs.
For our example, we’ll be signing up for their free plan (limited to 100 emails per day). However, the setup will be the same no matter which plan you choose.
Next, SendGrid will ask you to fill out a couple forms to create your account and set up a profile.
After you’ve created an account, click the Start button next to Integrate using our Web API or SMTP relay.
For the next step, you’ll be asked to choose a setup method. Go ahead and click the Choose button under the SMTP Relay option.
Next, you’ll need to enter an API key name and then click Create Key.
This will generate an API key for you. Be sure to leave this page open, as we’ll need this API key a little later.
2. Setting Up WP Mail SMTP
Now that your SendGrid account is prepped, we can switch over to setting up WP Mail SMTP.
Before we get started on this section, be sure to install and activate the WP Mail SMTP plugin.
Once WP Mail SMTP is installed, you’ll need to click on WP Mail SMTP in the left WordPress menu to open the plugin settings page. We’ll discuss each of these settings in detail below.
This is the email address that all of your site’s emails will be sent from.
You can also choose to check the box labeled Force From Email. If you’d like the From Email to be the same site-wide, this option will save you the trouble of editing the email settings throughout your site (in all form emails, etc).
The From Name will, by default, be set to the site name. However, you can change this to any text you’d like.
You can also choose to Force From Name to apply this setting to emails site-wide.
In the Mailer field, you’ll need to select the SendGrid option.
It’s also recommended to check the optional Return Path checkbox to Set the return-path to match the From Email. With this enabled, you should be emailed if any messages bounce as a result of issues with the recipient’s email.
The last step on this page is to scroll to the SendGrid section and enter the API Key. Go ahead and flip back to the tab or window where your SendGrid account is open to copy the key you generated earlier.
After copying the key, return to the WP Mail SMTP settings and paste it into the API Key field. Then, be sure to click the Save Settings button.
3. Verifying SendGrid Integration
Next up, you’ll need to verify the integration that you just created with SendGrid. To get this process started, you’ll need to send a test email from WP Mail SMTP.
Still in your WP Mail SMTP settings, click on the Email Test tab.
On this tab, you can enter any email address that you have access to. Then, click the Send Email button.
Once the email has processed, you should see a success message.
Now that your test email has been sent successfully, you’ll need to go back to your SendGrid account’s API page. There, check the box labeled I’ve updated my settings and then click Next: Verify Integration.
When the next page loads, click the Verify Integration button. This will send an email to SendGrid for verification.
Once SendGrid has detected that your test email has already been sent, they’ll let you know with a success message. This may take a few moments to complete.
At this point, it may look like your SendGrid setup is ready to go. However, for long-term, reliable email delivery we strongly recommend continuing to the next step.
4. Authenticating Your Domain in SendGrid
The best way to ensure that your emails continue to deliver successfully over time is to authenticate your domain.
Authentication proves that your emails come from a domain that you own. This, in turn, helps your domain’s reputation as a legitimate email source. As an added benefit, authentication will also remove the “via sendgrid.net” message that would otherwise get added to your emails.
Note: In order to move ahead with domain authentication, you’ll need access to your site’s DNS settings.
If you’re not sure where to find DNS settings, or feel unsure about making changes, please contact your site’s hosting provider before making adjustments. Or for more details on modifying a site’s DNS, you can check out WPBeginner’s tutorial on DNS settings.
To get started on authentication, in SendGrid’s left menu go to Settings » Sender Authentication (or simply follow this link).
Near the upper right of the page, click the Get Started button.
On the first authentication setup page, you’ll need to answer 2 questions:
- Which Domain Name Server (DNS) host do you use? Select your DNS provider from the available list. If you don’t see a match, then choose Other Host (Not Listed).
- Would you also like to brand the links for this domain? We recommend selecting Yes. This will allow any links in the emails that are sent to use your own domain, rather than SendGrid’s. Branded links help to further ensure delivery by keeping all links tied to your own site.
When these questions are complete, click the Next button.
For the next step, you’ll need to enter your site’s domain (ie
After entering the domain, click on Advanced Settings to open it. You’ll need make a couple of adjustments here:
- Uncheck the box labeled Use automated security.
- Check the box labeled Use custom return path.
- In the Return Path field, add a subdomain (see below for details).
What is a subdomain (Return Path)?
A subdomain replaces the “www” part of your website’s address. For example:
subdomain.yourwebsite.com. Subdomains can be used to add separate sections or directories to your website (for example, a site’s blog might be at blog.example.com).
In this case, the subdomain will only be used by SendGrid to send emails and will not be visible on your site at all.
Unless you have a specific subdomain in mind, consider using
sg — this is what we’ll use in our example here.
Note: The subdomain can be anything you’d like, however SendGrid recommends:
– Not using “mail”, as many hosting companies will already use this and it could cause conflicts.
– Not including any underscores (_) as this may not be compatible with some DNS providers
After clicking Next, the following page will display a list of DNS records that you’ll need to add for your site.
Note: If you’re not sure where to find your site’s DNS settings or feel unsure about making changes, please contact your site’s hosting provider before making adjustments.
Or for more details on modifying a site’s DNS, you can check out WPBeginner’s tutorial on DNS settings.
After you’ve opened up the DNS settings for your site, you should see an option to add a new record.
To make it possible for SendGrid to verify your domain, you’ll need to add three records to your site’s DNS. Be sure to copy them carefully, as you’ll need the exact values from your SendGrid account for the verification to work.
Note: If your DNS is managed by GoDaddy, then you will slightly adjust the Hostname shown in SendGrid. When entering the Hostname into your GoDaddy DNS, you’ll need to remove your normal domain. For example, instead of entering sg.yourdomain.com for the first TXT record’s Hostname, you would only enter sg
In your site’s DNS settings you may also see a TTL (Time To Live) field for the record. If you’re provided with a way to change this, we recommend setting the TTL to one day (or 86400 seconds, depending on the units your DNS uses).
After adding all 3 DNS records, check the box labeled I have added these records. Then, click the Verify button. DNS changes can take up to 48 hours to be recognized, so you may need to check back on this later.
If the verification worked, you should see a success message.
4. Sending a Test Email
Once your domain is authenticated, it’s a good idea to send one more test email. Back in your WordPress site’s admin area, you’ll need to go to WP Mail SMTP » Settings » Email Test.
Go ahead and enter any email address that you have access to. Then, click the Send Email button.
Once again, you should see a success message.
If you check the inbox for that email address, you should also soon receive the email for this test.
At this stage, it’s also important to check that your domain authentication worked. Each email provider will place this information in a different spot, but we’ll go ahead and share Gmail/G Suite as an example.
Within a Gmail or G Suite email, you’ll need to click the small arrow under the sender details. This should open more details about the email header. From here, check that the mailed-by value matches your subdomain (ie
sg.yourdomain.com). Then, check that the signed-by value matches your regular site domain (ie
Note: If these domains don’t match your subdomain/domain yet, then SendGrid may require a little more time to fully apply your setup. We recommending waiting at least an hour, then repeating this test process.
That’s it! You’ve just fixed your WordPress site’s email delivery issues with SendGrid using WP Mail SMTP.
Next, would you like to set up email logging? Be sure to check out our tutorial on how to log emails that are sent from your WordPress site.