WPForms Blog

WordPress Tutorials, Tips, and Resources to Help Grow Your Business

How to Setup Reliable WordPress Email Notifications with SendGrid with WP Mail SMTP

by Jess Quig on Jan 3, 2018

Have you noticed that you’re not receiving WordPress emails? Unfortunately, WordPress not sending emails is a common problem, but it’s easy to fix. In this tutorial, we’ll walk you through how to set up WordPress email notifications with SendGrid using WP Mail SMTP.

When Email Notifications Don’t Work

This can be a tricky problem, because you may not notice that WordPress isn’t sending form notifications until people start filling out your form, and their messages don’t reach your email inbox. You might notice form entries in your WordPress dashboard that haven’t been sent to your email, or discover there’s a problem when frustrated visitors reach out to you using social media or other methods.

Here’s what usually causes the problem…

By default, WordPress uses the PHP mail() function to send emails generated by WordPress or any contact plugin like WPForms.

The most common reason for missing these emails is when your WordPress hosting server isn’t configured to use the PHP mail() function.

Thankfully, you can work around this issue by using SMTP.

SMTP (Simple Mail Transfer Protocol) is the industry standard for sending emails. Unlike the PHP mail function, SMTP uses authentication which increases email deliverability. That’s why we recommend using SMTP to send emails in WordPress.

Why Use WP Mail SMTP with SendGrid?

There are many different SMTP services available, but many of these aren’t secure.

While other methods require you to store sensitive login information in your WordPress dashboard, using SendGrid in WP Mail SMTP will keep your email passwords secure.

SendGrid offers a free plan for sending up to 100 per day. For most small businesses and personal websites, that’s plenty. If you need to send more, you will likely need a paid service.

How to Find Your SendGrid API Key

Before we can configure your website to work with SendGrid, we need to set up an account and find your SendGrid API key. This key is a unique identifier and a secret token for authentication that will allow your website to interact with your account at SendGrid.

First, you’ll need to sign up for a SendGrid account. If you visit their pricing page, you can click the Try for Free link to start with a free trial.

Try a free SendGrid account

Note: In SendGrid, they provide a free option limited to 100 emails per day.

To get their free plan, you’ll first need to sign up for their free 30 day trial. At the end of the trial, you’ll be given the choice to continue on a free plan for under 100 emails a day.

Next, you’ll need to fill out a couple forms to create your account and set up a profile.

When creating your SendGrid account, be sure to use the same email address you’d like to set the From Email to in your form notification settings. These emails will need to match in later steps.

Create a new SendGrid account

After creating an account, click the Start button next to Integrate using our Web API or SMTP relay.

sendgrid integrate web API

Next, you’ll be asked to choose a setup method. You can now click the Choose button under the SMTP Relay option.

choose smtp relay for sendgrid setup

Now enter an API key name and then click Create Key.

Create a SendGrid API key

Once the API key has been generated, you’ll be ready to go to the next step. Be sure to leave this page open, as well need this API key a little later.

Copy the SendGrid API key

Using SendGrid with WP Mail SMTP to Fix WordPress Emails

Now we can get started setting up SendGrid with WP Mail SMTP on your WordPress site.

First, install the WP Mail SMTP plugin. Here’s a step by step guide on how to install a WordPress plugin.

While in your WordPress dashboard, go Settings » WP Mail SMTP.

Within the WP Mail SMTP Settings page, you can set the From Email and From Name. These will fill with your site’s admin email and site name by default, but we recommend setting the From Email to the same email address you used to create your SendGrid account for more reliable delivery.

WP Mail SMTP settings

Then in the Mailer field, select the SendGrid option.

Though optional, we also recommend checking the Return Path option to Set the return-path to match the From Email. That way, you’ll be notified if any messages bounce due to issues with the recipient’s email.

Select SendGrid as mailer in WP Mail SMTP settings and set Return Path

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.

Paste in SendGrid API key and save settings

Once these settings are saved, you’ll be ready to try sending a test email. To do this, click on the Email Test tab.

Send test email in WP Mail SMTP

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.

WP Mail SMTP test email was sent successfully

If you check the inbox for that email address, you should also soon receive the email for this test.

Test email for WPForms with SendGrid

Let’s finish by verifying the integration we just created. To do this, check the box labeled I’ve updated my settings and then click Next: Verify Integration.

Verify SendGrid integration

When the next page loads, click the Verify Integration button. This will send an email to SendGrid for verification.

Verify integration in SendGrid

Once the email has arrived to SendGrid, they’ll let you know with a success message. This may take a few moments to complete.

Success message from SendGrid integration verification

If you’d like, you can stop here and submit a form to test email delivery. However, for long-term delivery success we recommend proceeding to the next steps to verify your domain and whitelabel email links.

Verifying Your Domain

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.

Add domain for whitelabel

This will open a new panel, where you’ll need to enter a subdomain to use for whitelabeling. For our example, we’ll use the subdomain “em”.

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

Add new domain whitelabel to SendGrid

You can leave the Automated Security option set to On, then click Save.

Enabled SendGrid automated security and save changes

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.

SendGrid overlay to remind that DNS must be completed

After clicking Confirm, the next page will display a list of DNS records that you’ll need to add for your site.

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.

Add email link for whitelabel

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.

Set up email link whitelabel in SendGrid

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 an click Confirm.

On the next screen, you’ll be provided with two additional DNS records to add to your site.

DNS records to add for email whitelabel

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 may need to check back again later.

Note: Be sure to submit a couple of test forms after completing this setup to check that emails deliver successfully.

If you see any issues, we recommend setting the From Email in your form’s notification settings to the same email you set up SendGrid with.

That’s it! When WordPress can’t send emails, you’re able to fix the problem. Now you’re ready to fix WordPress email notifications with SendGrid using WP Mail SMTP.

Looking for more email notification tips? You might also want to check out our guide on How to Send Users Confirmation Emails from WordPress Forms, which will show you how to send a thank you message to anyone who fills out your form.

Don’t have WPForms yet? What are you waiting for? Get started with the most powerful WordPress forms plugin today.

If you like this article, then please follow us on Facebook and Twitter for more free WordPress tutorials.

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.