Skip to content
← All Insights

FluentSMTP and Microsoft 365: The OAuth Setup That Actually Works

FluentSMTP and Microsoft 365: The OAuth Setup That Actually Works

WordPress does not send email reliably on its own. The default wp_mail() function uses PHP mail, which most hosts either block entirely or send through a configuration that Microsoft 365 rejects as spam or refuses to deliver altogether.

The fix is SMTP — sending WordPress email through an authenticated mail account instead of PHP mail. FluentSMTP is one of the better free plugins for this. Getting it working with Microsoft 365 using OAuth is where most people get stuck.

Here is the exact setup that resolved delivery for a client after weeks of failed sends.

Why Password-Based SMTP Fails With Microsoft 365

Microsoft has been deprecating Basic Authentication — username and password SMTP — across its 365 platform since 2022. Many Microsoft 365 accounts now have it disabled at the tenant level, which means even if your SMTP credentials are correct, the connection is rejected.

OAuth 2.0 is the authentication method Microsoft now requires. Instead of a password, you register an application in Azure Active Directory, grant it mail permissions, and use a client ID and secret to authenticate. It sounds more complicated than it is.

What You Need Before You Start

Access to the Microsoft Azure portal at portal.azure.com — you need to be a Global Administrator or have Application Administrator permissions on the Microsoft 365 tenant. If the site belongs to a client, this is the step where you involve their IT contact.

You also need FluentSMTP installed and active on your WordPress site.

Registering the App in Azure

In the Azure portal, go to Azure Active Directory → App registrations → New registration. Give it a name (something like “WordPress Mail — sitename”), set the account type to the tenant only, and set the redirect URI to the callback URL that FluentSMTP shows you in its Microsoft 365 connection screen — it will look like:

https://yoursite.com/wp-admin/options-general.php?page=fluent-mail

Once registered, go to API permissions → Add a permission → Microsoft Graph → Delegated permissions. Add Mail.Send. Then grant admin consent — this step requires administrator access on the tenant.

Go to Certificates and secrets → New client secret. Set an expiry date, then copy the value immediately — you will not see it again after you leave the page.

Connecting in FluentSMTP

In WordPress, go to FluentSMTP settings and choose Microsoft 365 / Outlook as the mailer. Enter the Application (client) ID from your app registration, the client secret you copied, and your Microsoft 365 sending address. Save and connect — it will redirect you to a Microsoft login to authorize the connection.

Send a test email from FluentSMTP’s test screen. If it delivers, you are done.

The Most Common Failure Points

If the test email fails, the most likely cause is one of three things:

  • The redirect URI in Azure does not exactly match the URL FluentSMTP expects
  • Admin consent was not granted for the Mail.Send permission
  • The sending address does not match the account that authorized the OAuth connection

Check each of these in order before assuming the setup is wrong. In our experience, a mismatched redirect URI is responsible for the majority of failed connections.

One Thing Worth Noting

The client secret has an expiry date — maximum two years in Azure. Set a calendar reminder to rotate it before it expires. When it does, WordPress email will silently stop sending until you generate a new secret and update FluentSMTP. It is the kind of thing that gets discovered when a contact form stops delivering leads, not before.