Would you like a reliable, secure email delivery solution that works with a variety of email addresses? SendGrid 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
- Verifying 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.
We’ll finish up this step by verifying the integration we just created with SendGrid. To do this, 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 the email has arrived at SendGrid, they’ll let you know with a success message. This may take a few moments to complete.
If you’d like, you can stop here and run a test email within WP Mail SMTP. However, for long-term delivery success we recommend verifying your domain.
3. Verifying Your Domain in SendGrid
The best way to ensure that your emails continue to deliver successfully over time is to verify your domain. In SendGrid, this is called “whitelabeling”, which means that your emails will appear to come from your own domain rather than SendGrid.
To get started on verification, you’ll need to open Settings » Whitelabels in SendGrid’s left menu (or follow this link).
Then, click the + Add Domain button.
This will open a new panel, where you’ll need to enter a subdomain to use for whitelabeling.
What does this mean, exactly? 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 (like how some sites have their blogs on a subdomain such as blog.example.com).
In this case, the subdomain will be used by SendGrid to send emails and will not be visible on your site at all.
For our example, we’ll use the subdomain “em” (em.example.com).
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
You can leave the Automated Security option set to On, then click Save.
Saving these settings will cause an overlay to appear. This will let you know that we still need to make DNS changes, which we’ll do in the next step.
After clicking Confirm, the next page will display a list of DNS records that you’ll need to add for your site.
Note: For more details on modifying your site’s DNS, we recommend WPBeginner’s tutorial on DNS settings.
If you have additional questions about DNS or feel unsure about making changes, please contact your site’s hosting provider.
After adding these DNS records, click the Validate Records button. DNS changes can take up to 48 hours to be recognized, so you may need to check back on this later.
In the meantime, let’s continue to the other part of whitelabeling: Email Links.
Whitelabel Email Links
Whitelabeling email links will allow any links in the emails that are sent to use your own domain, rather than SendGrid’s. This will help to further ensure delivery by keeping all links tied to your own site.
To whitelabel email links, return to Settings » Whitelabels in SendGrid’s left menu. Then, click the + Add Email Link button.
In the overlay that opens, you’ll need to enter another subdomain to be used in email links. This can be anything you like, though SendGrid’s documentation suggests “link” or “click” as good options.
For this example, we’ll use “link” as our prefix. Then you’ll need to select your domain and Save these settings.
Just as we saw in the previous step, an additional overlay will appear reminding you that DNS changes will take up to 48 hours to take effect. Go ahead and click Confirm.
On the next screen, you’ll be provided with two additional DNS records to add to your site.
After adding these records to your site’s DNS, you can check back here click the Validate Records button. Remember that this may take a while, so you will likely need to check back again later.
4. Sending a Test Email
Now that your setup is complete, you’re be ready to try sending a test email. To do this, click on the Email Test tab.
On this tab, you can enter any email address that you have access to and click the Send Email button.
Once the email has processed, 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.
That’s it! You’ve just fixed your WordPress site’s email delivery issues with SendGrid using WP Mail SMTP.