How to send email using SMTP and Microsoft 365 in WordPress


When setting up WordPress websites, there’s a fairly common issue which can sometimes be encountered, relating to the delivery of emails. The problem is that emails sent by the website fail to arrive in your inbox or perhaps keep landing in spam, and you may be left scratching your head as to why they’ve gone missing.

The most common examples of the emails that could be affected are those that should be sent to you when someone sends an enquiry via forms on your website, and the verification email which should be sent when there’s a change of admin ownership for the website in Settings > General.

Initial troubleshooting

The first things to check in these cases should be your SPF (Sender Policy Framework) and DKIM (Domain Keys Identified Mail) records within the DNS for your domain, as these control which servers are permitted to send emails on behalf of your domain – the system is designed to prevent people sending fake email pretending to be you. It’s a little bit technical – but don’t worry, we can happily check this out for you – just ask!

You may still find that the email delivery issue persists even after checking that your SPF and DKIM are correct. In these cases, and particularly if you’re using a 3rd party such as Google Workspace or Microsoft 365 for your domain’s email hosting, the root cause is probably something else.

The next thing to check should be your Email Routing configuration in cPanel – if you’re using a 3rd party service such as Google Workspace or Microsoft 365, you should select the Remote Mail Exchanger option.

If that still doesn’t solve it and you’re using Microsoft 365 to send business email over your domain, the next step is to set up something called SMTP (Simple Mail Transfer Protocol). This makes everything much more robust and reliable and is pretty much guaranteed to solve the problem.

It takes a little bit of work to set up, but don’t worry – if you’re an erjjio client we can take care of most of the technical stuff, so you don’t have to.

Overview of our recommended process

In the following steps we’ll show you exactly how to set up and configure SMTP and solve your email deliverability problem, using an excellent SMTP plugin for WordPress called Post SMTP.

There are several other SMTP plugins for WordPress out there to choose from, however we feel this one is currently the best on offer, because:

  • It has an integrated email log, which shows you which emails were sent successfully and which failed, along with an extremely handy button to easily resend any emails;
  • The email log works as soon as the plugin is installed, even if SMTP hasn’t been configured yet;
  • It has a webhook integration for Slack, so you (or we) can get instant alerts if an email fails to send.

The main downside when using it with Microsoft 365 business email however, is that it requires a paid extension for the main SMTP plugin – whereas it’s free to use with Google Workspace for example. Despite this drawback, we still feel that the above benefits outweigh the cost. If these features/benefits aren’t very important to you however, in our opinion the next best and free alternative is FluentSMTP, which you could try instead.

You’ll need to purchase the licence for the Post SMTP Microsoft 365 extension first, before proceeding with the rest of the steps below.

Set up the Post SMTP plugin

1. Install and activate the main Post SMTP plugin – it’s available for download in the WordPress repository here or via the Plugins > Add Plugins section in your WordPress dashboard.

2. You will see a message asking for your permission for the plugin’s developers to track non-sensitive diagnostic data about the plugin’s usage on your website. Our view is that it’s safe to opt in to this, but feel free to opt out by clicking skip if you prefer. If you opt in, you’ll receive an automated email asking you to confirm your email address, with a button to click on.

3. When you receive your purchase confirmation email for the plugin extension, download it using the Office365 Addon Office 365 SMTP Pro Plan link in the email as shown below, then copy your unique license key to your clipboard too.

4. Install and activate the downloaded plugin in your WordPress dashboard in the normal way, then paste your license key into the activation window when prompted. This can also be entered/updated via the Change License link in your plugin list as shown below.

5. Once both plugins are active, go to the Post SMTP tab in your WordPress dashboard and click the Start the Wizard button on the left.

6. Select the Office365 API option, then click the Continue button.

7. In the configuration window you arrive at next, enter the “From Email” (which should exist in your Microsoft 365 account already) which you would like your website to send admin emails from e.g. – and the “From Name” you would like the sent emails to be labelled with e.g. Your Company Name.

8. Next, you’ll need to set up an App ID, App Secret and Redirect URI in your Microsoft 365 / Azure account in order to proceed. Follow the plugin’s instructions here to create these – see the “Creating a client ID” section of their page onwards.

  • The Application ID and Client Secrets Value will get produced in your Azure account (as per the instructions shown in the help page above), and you should then copy/paste them into the respective fields of the Post SMTP configuration wizard as shown below.
  • Whereas the opposite applies for the Redirect URI – the Post SMTP plugin should generate this for you automatically, and you should then copy/paste it into your Azure portal.
  • Note that it’s also generally helpful to set up two of these Redirect URIs in your Azure account – one for your development/staging website, and another for the live/production website:
    • The development website we build for you during a project will have a URI in the format:[your project name]/wp-admin
    • Whereas the live website will usually be: https://[your own domain]/wp-admin

9. Click the Connect to Office 365 button shown above to finalise the authentication, then sign-in to the Microsoft account which administrates the email address you will be using, and follow the prompts to accept the permission requests (see the Connecting to Office 365 for Authentication section in the Post SMTP plugin documentation mentioned above).

10. Click the Save and Continue button in the bottom-right of the window.

11. Follow the final prompts in the wizard to send a test email.

That’s it – all done!

If you’re an erjjio client and you get stuck with any of the above, please get in touch 🙂

Reader Interactions


  1. Abdulrehman Altaf says

    thanks for the info and good article.
    update, before “Begin by setting up the Post SMTP plugin”
    make sure to enable SMTP from office on specific account/tenant level, other wise its not going to work.

    Use the Microsoft 365 admin center to enable or disable SMTP AUTH on specific mailboxes
    1: Open the Microsoft 365 admin center and go to Users > Active users.
    2: Select the user, and in the flyout that appears, click Mail.
    3: In the Email apps section, click Manage email apps.
    4: Verify the Authenticated SMTP setting: unchecked = disabled, checked = enabled.
    5: When you’re finished, click Save changes.

Leave a Reply

Your email address will not be published. Required fields are marked *