WordPress Emails on Azure Configuring SendGrid

When hosting a WordPress site as an App Services site on Azure you will find email will not work. Microsoft does not provide the ability to send emails directly from the App Services site, you need to use an external relay service such as SendGrid instead

https://docs.microsoft.com/en-us/azure/virtual-network/troubleshoot-outbound-smtp-connectivity

Table of Contents

Setting up SendGrid on Azure

Within your Azure subscription, create a new resource searching for and selecting SendGrid

As when creating an Azure resource complete the wizard defining your Resource Group and the other properties required or SendGrid. I won’t go into a lot of details here on setting up SendGrid as Microsoft had a great bit of documentation already.

https://docs.microsoft.com/en-us/azure/sendgrid-dotnet-how-to-send-email

Setting up a SendGrid API Key

Within your SendGrid resource select Overview => Manage

Next on left navigation select Settings => API Keys

In the top right click Create API Key

Give your API a name and if you are only sending an email using this API key you can just set the permission as Restricted Access and the only permission that is needed is Mail Send

Press Create & View at the bottom

Make sure you take a copy of the new API key as you won’t get to see it again in SendGrid!

WordPress

As you would imagine with WordPress there are a few ways to get mails sending via SendGrid. I personally like to use a free plugin called “Post SMTP Mailer/Email Log”

Within your WordPress admin console search for, install, and active the “Post SMTP Mailer/Email Log” plugin.

Under Plugins select Settings for the newly install “Post SMTP” plugin

Click “Start the Wizard”

Set your from address as required and click Next

Set the “Outgoing Mail Server Hostname” as smtp.sendgrid.net and press Next

Select SendGrid API and click Next

Paste in your API Key created earlier in SendGrid. If you no longer have the key you will need to delete and create a new one. Click Next

On “6. Notifications” just press Next and then Finish

Finally try sending a test mail with the “Send a Test Email” wizard

Troubleshooting

You may want to add SendGrid into your domains SPF records i.e. v=spf1 include:sendgrid.net ~all. For more information on SPF, DKIM and DMARC check out this post SPF, DKIM and DMARC Confused?

I personally had an issue with my email filtering solution blocking the emails as a spoofing attempt so I had to add a bypass rule

Want to use an Azure Front Door?

If you want to host your WordPress site behind an Azure Front Door take a look at this post WordPress & Azure Front Door Too Many Redirects

Want a fast WordPress theme or looking to improve your Ad revenue?

That a look at my Tools I Use page for some recommendations!

1 thought on “WordPress Emails on Azure Configuring SendGrid”

  1. Greetings of the Day, Team! Your content about “WordPress Emails on Azure Configuring SendGrid” is good. In This blog, your Explanation about Sendgrid on the azure topic and your given link are beneficial to me to understand clearly. Setting up API Keys Overview was useful. Thanks for Sharing your Info!

    Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.