Sending emails with SendGrid from your WordPress website

Depending on where you host your website, you may not have ever needed to consider how your site sends email. Most shared-hosting services handle outgoing emails automatically. But, if you are setting up your site on a Digitial Ocean or AWS server, that may not be the case. If that's the case, you will need to use a 3rd-party mail service. One great option to consider is SendGrid.

Even if your hosting provider provides email service, there are several reasons to consider using SendGrid. Personally, I'm a big fan of the stats. Being able to see how many emails are sent, opened, or clicked can be extremely helpful. And, depending on the types of emails you send from you site, you may be interested to read about SendGrid's deliverability.

Why SendGrid?

Of course, there are plenty of services that you could use for sending email. So you may be wondering why I'm suggesting SendGrid. That part is easy and it comes down to two key reasons; price and the ease of setup.

First, let's talk about price. For sites that send less than 100 emails per day, SendGrid has a cost-free option that doesn't even require a credit card to sign up. For the vast majority of websites, this free tier is something they'll be able to use forever. But if you find you're reaching the 100/day limit, they have plans that start for as little as $19.95/month.

As for setup, for the past few years, I have been using a different email provider and I can tell you that the setup can be a bit confusing for non-technical clients. Asking a client to make changes to their DNS settings can be a challenge. With SendGrid, the setup process is simple and takes only a few minutes.

Setting Up SendGrid

The first step, of course, is to create an account at SendGrid. Once you log in, you will need to set up an API Key for your website. Do this by clicking on Settings -> API Keys in the left-hand nav bar. This will take you to the API Keys page where you will see a list of all API Keys you've created.

Just a quick note to point out that you can use a single SendGrid account to send emails from multiple websites. If you do, my suggestion would be to create a unique API Key for each individual site.

On the API Keys page, click the “Create API Key” button in the top-right corner. This will bring up the Create API Key page.

Create API Key page

Give your API Key a unique name. Your website name, for example. Click the Restricted Access option followed by the Create & View button. This will expand the list of Acess Details. Scroll down to find and click on the Mail Send option. Click the Mail Send and Scheduled Sends options. It should look like the screenshot below when you're done.

Mail Send options

Click the Create & View button to see your newly created API Key.

API Key Created

Be sure to click on the code itself to copy it to the clipboard and then paste it into a text document. We will use it in the next step. Once you click the Done button, you will not be able to see the key again and will need to create a new one if you lose it.

Authorize a Sender

One final step that you'll need to do in SendGrid is to authenticate a sender. SendGrid's documentation for this step is excellent, so I won't bother repeating it but will instead suggest you follow these steps which should only take you a couple of minutes.

That's it for setting up SendGrid. Time to focus on WordPress.

Setting Up WordPress

To set up your website to use SendGrid, you will start by installing the FluentSMTP plugin. If you are unsure how to install a plugin, feel free to contact me for assistance. Once the plugin is installed and activated, go to Settings -> Fluent SMTP in the left-hand nav bar where you'll be instructed to set up your first email service provider. Click the SendGrid logo to get started.

FluentSMTP welcome screen

Next, you will be shown the Sender Settings form. Here you will specify the From Email and Name and the API Key. I also click the Force Sender Name option so it uses the same name/email for all emails being sent from the website. You can leave the Store API Key in DB option as-is. Click the Save Connection Settings button to continue.

Sender Settings form

Once done with the Sender Settings form, you'll be taken back to the default Fluent SMTP home screen where you'll see a list of your Active Email Connections.

Active Email Connections

To test that everything is working as it should, click the Email Test link at the top of the screen. Fill in the From and Send To fields and click Send Test Email to send the email. Assuming all goes well, you will have an email in your inbox and you should see the following message.

Test Email successfully sent

Before we go…

If you're like me, the next thing you're going to do is rush over to SendGrid to check your stats. Before you freak out that you don't see any new stats and think you've done something wrong (I'm not saying I did that, but I'm also not saying I didn't), keep in mind that the Test Email tool does not trigger a hit on your stats. If you want to confirm stats are working, I typically log out of my WordPress website and then use the Password Reset tool to trigger an email. When you receive the password reset email, simply delete it and your password will remain unchanged.

That's it. Hopefully, you found the process of setting up SendGrid for your website easier than you expected. I know it was for me.

Header photo by Brett Jordan on Unsplash