How to Configure SendGrid in WordPress to Send Emails

wordpress sendgrid

WordPress can send basic emails like registration and password reset messages. However, many web hosting providers do not support this feature or don’t offer email services at all. In that case, you can use a service like SendGrid, which handles emails for some of the world’s biggest companies. SendGrid can send both marketing emails and important one-time emails like password resets or order confirmations. It makes sure your site’s emails get delivered properly.

In this write-up, we’ll show you how to set up SendGrid with your WordPress site in a few simple steps.

Why You Need This Setup

WordPress, by default, uses the PHP mail() function to send emails. The mail() method lacks authentication and often causes emails to land in the spam folder or not be delivered at all. That’s why many users never receive important notifications like password resets, contact form messages, or order confirmations.

To fix this issue, you can integrate a reliable email delivery service like SendGrid using SMTP server or its API. SendGrid authenticates your emails and makes them appear trustworthy to mail providers like Gmail, Outlook, and Yahoo. This way, SendGrid significantly improves the chances of your emails reaching the inbox.

For example, imagine you run an online store with WooCommerce. A customer places an order, but they never receive the confirmation email because your server sent it using the default mail() method, and it was flagged as spam.

Now, let’s say you’ve configured the SendGrid WordPress plugin on your site. The next time a customer places an order, the confirmation email goes out through SendGrid’s trusted servers. If it passes all necessary authentication checks, the email lands safely in their inbox.

Configuring SendGrid in WordPress to Send Emails

Before we get started, make sure you have a SendGrid account. If not, go to their website and sign up for a free account. 

Sign up for SendGrid

Visit the official SendGrid website and click on the Start for free button to create your SendGrid account:

start sendgrid for free

Provide the required details and click on the Continue button to create your account:

sign up to sendgrid

Verify your email by specifying the appropriate code:

verify email

Create a Sender Identity in SendGrid WordPress

Once your account is ready, you need to create your sender identity. You have two options:

  • Add a Single Sender
  • Authenticate Your Domain (Recommended)

Although setting up a single sender works, the recommended method is domain authentication for better email delivery. Let’s go through both options one by one:

Option 1: Add a Single Sender

Sign in to SendGrid and click the “Create Identity” button:

create single identity

Provide the necessary details and then click on the Create button:

create a sender

After this, you will be navigated to the following window:

sender created

Check your inbox for a confirmation email and click the link to verify:

verify your single sender

Option 2: Authenticate Your Domain (Recommended)

Domain authentication proves that emails are coming from a domain you own. This builds your domain’s reputation and prevents your emails from being marked as spam. 

From your SendGrid dashboard, scroll down and click Authenticate Domain. You can do this by going to Settings > Sender Authentication:

sender authentication sendgrid

After this, you’ll be prompted with two questions to authenticate your domain. First, select your DNS provider (such as ultahost) from the dropdown list:

authenticate your domain sendgrid

If your DNS provider is not available in the list, you can “choose Other Host (Not Listed)”. Next, select Yes to use your domain for email links instead of SendGrid’s:

specify DNS provider if it is not available by default

Now you need to specify the domain name and uncheck the box for “use automated security” setting:

enter your from domain

After that, tick the box labeled “Use Custom Return Path” and enter a subdomain in the Return Path field. A typical website address looks like www.example.com, but a subdomain replaces the www with something else. For example, blog.example.com is often used for a blog section. Subdomains like this help create separate parts of a website:

edit additional settings sendgrid

If you’re not sure what to use, we suggest typing SG as the subdomain. After entering it, click Next. The next page will show you the DNS records:

install dns record

Add DNS Records

Open a new tab and log in to your domain provider (usually your hosting company). Navigate to your domain’s DNS Settings and click on the “Add New Record” button to add a new DNS record:

add new record

Select the Type from the list, copy the Host value from SendGrid, and paste it into the Name/Host field. Then, copy the Value and paste it into the Value field. Set the TTL to 1 day or 86400 seconds, if it’s editable:

specify dns record

Repeat this for all the required records. After adding all DNS records, return to SendGrid and check the box “I have added these records”, then click Verify:

verify sendgrid

It can take up to 48 hours for SendGrid to verify the records.

Generate an API Key

The next step is to create an API key. In your SendGrid dashboard, click on Email API from the left menu, Integration Guide, and select SMTP Relay. 

integrate using web api or smtp relay

After that, click the Create Key button to generate your API key:

create key

Copy the API key and keep this tab open.

Configure WP Mail SMTP in WordPress

Log in to your WordPress site and go to WP Mail SMTP > Settings. After this, enter an email address in the From Email field that matches your verified domain. Check the box Force From Email. In the From Name field, enter a name you want to appear on outgoing emails. You can also check Force From Name:

configure wp mail smtp

Scroll down to the Mailer section and select SendGrid:

select sendgrid

Once you select the SendGrid option, two new fields will appear:

sendgrid options

Now, go back to your SendGrid account and copy the API Key:

copy api key

Paste the key you copied from your SendGrid account to the API key field. The Sending Domain is Optional. You can enter the subdomain you created in the Sending Domain Field:

Paste api key from your SendGrid

Finally, click the Save button to apply the Settings.

Send a Test Email

After configuring SendGrid, go to WP Mail SMTP > Tools > Email Test. Enter your email address in the Send To field and click Send Email:

send test mail sendgrid

That’s it! You’ve now successfully configured WordPress SendGrid plugin to send emails:

test email confirmation

Finally, you can check your inbox to verify that you have received the test email.

Final Thoughts

You can use SendGrid in WordPress to send important emails like user registration, password resets, or order confirmations. This setup helps you avoid common email delivery problems that often happen when your web host doesn’t support built-in email services. Instead of relying on the default PHP mail() function, which can cause emails to land in the spam folder or not be delivered at all, SendGrid ensures that your emails are sent through a trusted and authenticated platform.

To get started, first create a SendGrid account, then set up your sender identity by either adding a single sender or authenticating your domain. After that, update your DNS records as provided by SendGrid and generate an API key. Finally, install and configure the WP Mail SMTP plugin in your WordPress dashboard using the API key.

Once you’ve completed these steps, send a test email to make sure everything is working correctly.

We hope this article has helped you configure SendGrid in WordPress to send emails. Experience Ultahost’s Email Hosting to host your business email on a secure, privacy-guaranteed platform. Promote your site with every message you send with an email address that matches your website. Check out our plans!

FAQ

Why are my WordPress emails not being delivered?
Is SendGrid free to use with WordPress?
What is the difference between Single Sender and Domain Authentication in SendGrid?
Can I use SendGrid with WooCommerce?
How long does it take for DNS changes to verified by SendGrid?
Do I need to use WP Mail SMTP to integrate SendGrid with WordPress?
How can I test if my SendGrid email setup is working?

Related Post

How To Install WordPress With Docker Compose

Docker Compose is a powerful tool designed to simplify ...

How to Install and Setup WordPress Multisite

WordPress Multisite is a powerful feature that allows y...

How to Embed a YouTube Video in WordPress

WordPress is a popular platform that allows users to cr...

How to Fix WordPress RSS Feed Errors

RSS feeds continue to be a stable presence in the const...

How to Disable Greylisting for cPanel Email

Greylisting is a technique used by mail servers to bloc...

How to Change Font in WordPress

Typography plays an important role in the visual appeal...

Leave a Comment