Plugins Plugin hub Backup SEO Caching Security Forms WooCommerce Images Best backup plugins
Hosting Hosting directory Shared hosting Managed WordPress Cloud hosting VPS hosting By reader location Hosting finder
Themes & builders Compare Rank Math vs Yoast
Tools All tools Hosting finder Plugin stack builder Cost calculator Salt generator Theme detector Who is hosting this? Speed test Headline analyzer robots.txt generator Redirect generator Uptime calculator Blog name generator
Blog Best backup plugins Deals
Guides All guides Speed up WordPress Choose hosting Back up WordPress
How we test

Troubleshooting

WP Mail SMTP Office 365 Not Working: Causes and How to Fix It

WP Mail SMTP Office 365 Not Working: Causes and How to Fix It

Short answer

WP Mail SMTP usually fails with Office 365 because of a redirect URI mismatch, an expired client secret, missing permissions or admin consent, or SMTP AUTH and basic login blocked by Microsoft. Read the error code from a test email, then fix the matching setting in your Azure app or Microsoft 365 admin center.

Key takeaways

  • Send a test email first and note the AADSTS or 5.7.x code.
  • Redirect URI must match WP Mail SMTP exactly in Azure.
  • Expired client secrets stop email with no warning.
  • Use the Outlook OAuth mailer instead of password-based SMTP.
  • From Email must be the authorized, licensed mailbox.

Why is WP Mail SMTP not working with Office 365?

WP Mail SMTP usually fails with Office 365 because the Azure app is set up wrong, the client secret expired, the account lacks a licensed mailbox, or the site uses basic SMTP login that Microsoft blocks.

WP Mail SMTP can connect to Microsoft in two main ways. The Outlook mailer (labelled Microsoft 365 / Outlook.com) signs in with OAuth through an app you register in Microsoft Entra ID (formerly Azure Active Directory). The Other SMTP mailer logs in to smtp.office365.com with a username and password.

Each method breaks in its own way:

Connection methodTypical failure
Outlook mailer (OAuth)Wrong redirect URI, expired client secret, missing permissions, consent not granted
Other SMTPSMTP AUTH disabled for the tenant, basic auth blocked, MFA on the account
BothFrom address not allowed, mailbox unlicensed, Microsoft spam filters

Start by finding the exact error. Then match it to the sections below.

How do you find the real error message?

Send a test email from WP Mail SMTP > Tools > Email Test and read the debug output, because Microsoft error codes tell you exactly which part failed.

The test screen shows the response from Microsoft when a send fails. Copy the full message. Look for codes that start with AADSTS (sign-in and app problems) or 5.7.x (SMTP and mailbox rules).

Also check WP Mail SMTP > Tools > Debug Events if your version has it, and the email log in the Pro version. Our guide on how to test WP Mail SMTP walks through each test option.

Quick code guide:

  • AADSTS50011: the redirect URI does not match the one in your Azure app
  • AADSTS7000215: the client secret is wrong, often because you copied the secret ID instead of the value
  • AADSTS700016: the application ID was not found in the directory
  • 5.7.139 or SmtpClientAuthentication is disabled: SMTP AUTH is off for the tenant or mailbox
  • 5.7.3 Authentication unsuccessful: wrong password, MFA, or basic auth blocked

Is the redirect URI set correctly in Azure?

A redirect URI mismatch is the most common Outlook mailer error, and you fix it by pasting the exact URI from WP Mail SMTP into the Web platform settings of your Azure app.

WP Mail SMTP shows a redirect URI on its settings page when you pick the Outlook mailer. Copy that value exactly. Do not type it by hand.

In the Microsoft Entra admin center or Azure portal:

  1. Open App registrations and select your app
  2. Go to Authentication
  3. Under the Web platform, add the redirect URI from WP Mail SMTP
  4. Save, then try the authorization again in WordPress

Watch for small differences. A missing www, http instead of https, or an extra slash all count as a mismatch. If you moved the site to a new domain, the old URI in Azure will no longer match.

The WP Mail SMTP Outlook mailer documentation shows the full app setup with screenshots.

Has the client secret expired?

Client secrets in Azure expire on the date you chose when creating them, and when that happens WP Mail SMTP stops sending with no change on your side.

This catches many sites months after a working setup. Email simply stops one day. The error usually mentions an invalid or expired client secret.

To fix it:

  1. In your Azure app, open Certificates and secrets
  2. Create a new client secret and pick an expiry period
  3. Copy the Value column right away, not the Secret ID
  4. Paste it into WP Mail SMTP as the Client Secret
  5. Save and click the button to reauthorize the plugin with your Microsoft account

Microsoft only shows the secret value once. If you leave the page without copying it, create another one.

Put a reminder in your calendar a few weeks before the new expiry date. That turns a surprise outage into a five-minute task.

The Azure app needs the Microsoft Graph permissions WP Mail SMTP asks for, and an admin may need to grant consent before any user can authorize the plugin.

Check API permissions in your app registration. The WP Mail SMTP docs list the permissions to add, which include a mail sending permission. Use the list in their current docs, since requirements can change.

Many organizations block users from consenting to new apps. If you see a message that you need admin approval, ask a Microsoft 365 global admin to grant admin consent for the app on the API permissions page.

Also check the Supported account types on the app. A tenant-only setting will not work for a personal Outlook.com account, and the reverse is also true.

Microsoft documents app registration in Register an application with the Microsoft identity platform.

Is SMTP AUTH turned off for your tenant?

If you use the Other SMTP mailer, Microsoft must allow authenticated SMTP for the mailbox, and many tenants have it switched off by default.

The error often reads SmtpClientAuthentication is disabled for the Tenant. An admin can turn on authenticated SMTP for a single mailbox in the Microsoft 365 admin center, under the user's mail settings, or with Exchange Online PowerShell.

Before you do that, think about the bigger picture. Microsoft has been retiring basic authentication (username and password) for SMTP AUTH in Exchange Online. Once basic auth is blocked, a plain password login fails even if SMTP AUTH is enabled.

That makes the OAuth-based Outlook mailer the safer long-term choice. Check the Microsoft guide to SMTP AUTH in Exchange Online for the current status and dates.

If you must keep Other SMTP for now, these are the usual settings:

SettingValue
SMTP hostsmtp.office365.com
EncryptionTLS
Port587
AuthenticationOn
UsernameFull mailbox email address

Is multi-factor authentication blocking the login?

Accounts with MFA cannot log in with a plain password over SMTP, so either use the OAuth Outlook mailer or a separate method approved by your admin.

Security defaults in Microsoft 365 turn on MFA for many tenants. When that happens, an SMTP login that worked last month starts failing with an authentication error.

Older guides suggest app passwords. Those depend on legacy per-user MFA and admin policy, and many tenants no longer allow them.

Do not weaken account security just to send site email. Switch to the Outlook mailer instead.

Does the From address match a licensed mailbox?

Microsoft only lets you send as a mailbox the signed-in account owns or has rights to, so a From Email that differs from the authorized account is rejected or rewritten.

In WP Mail SMTP, set the From Email to the same address you authorized. If you want to send as a shared mailbox or alias, the account needs Send As permission in Exchange, and the plugin settings must match.

Also check that the account has an active Exchange Online license. An unlicensed account has no mailbox, so nothing can be sent from it.

Tick Force From Email in WP Mail SMTP so other plugins cannot change the sender. Contact form plugins often set the visitor's address as the From, which Microsoft will block. Our WordPress form email settings guide explains how to set Reply-To instead.

Are emails sending but not arriving?

If the test says success but mail never arrives, Microsoft accepted it and the problem is delivery, which usually means spam filtering, quarantine, or missing DNS records.

Check these places:

  • The Junk folder of the recipient
  • The quarantine in the Microsoft Defender portal
  • The Sent Items folder of the sending mailbox, which proves Microsoft sent it
  • Message trace in the Exchange admin center

Make sure your domain has SPF, DKIM and DMARC records that include Microsoft 365. Our guide on how to set up SPF, DKIM and DMARC for WordPress email covers each record.

Could another plugin or the host be interfering?

Yes, other mail plugins, security plugins and hosts that block outbound ports can all break the connection, so rule them out after the Microsoft settings are correct.

Run through these checks:

  1. Deactivate any other SMTP or mail plugin, since only one should control wp_mail
  2. Check security plugins that block outgoing HTTP requests, which the Outlook mailer needs
  3. Ask your host whether outbound port 587 is open if you use Other SMTP
  4. Make sure the server clock is correct, since OAuth tokens depend on accurate time
  5. Update WP Mail SMTP, WordPress and PHP

The core wp_mail function reference explains how WordPress hands email to plugins like this one. If you are still stuck, our guide to WP Mail SMTP not sending emails covers general causes beyond Microsoft.

What is the quickest fix checklist?

Work from the error code, then confirm redirect URI, secret, permissions, From address and DNS in that order, and send a test after each change.

  1. Send a test and copy the exact error
  2. Match the redirect URI in Azure to the one in WP Mail SMTP
  3. Create a new client secret and paste the Value
  4. Confirm API permissions and admin consent
  5. Set From Email to the authorized, licensed mailbox
  6. Reauthorize the plugin
  7. Check SPF, DKIM and DMARC
  8. Review message trace if mail is sent but not received

If you decide Microsoft is too much work, you can switch WP Mail SMTP to another mailer. Our overview of what WP Mail SMTP is lists the other options it supports.

Frequently asked questions

Why did WP Mail SMTP stop working with Office 365 suddenly?

The most common reason is an expired client secret in your Azure app. Secrets have a fixed expiry date. Create a new secret, paste its value into WP Mail SMTP, save, and reauthorize the plugin with your Microsoft account.

What does AADSTS50011 mean in WP Mail SMTP?

It means the redirect URI sent by WP Mail SMTP does not match any redirect URI in your Azure app. Copy the URI shown in the plugin settings and add it under Authentication for the Web platform in the app registration.

Can I use smtp.office365.com with a password?

Only if SMTP AUTH is enabled for the mailbox and basic authentication is still allowed. Microsoft has been retiring basic auth for SMTP in Exchange Online, so the OAuth Outlook mailer is the more reliable choice.

Does WP Mail SMTP work with a personal Outlook.com account?

It can, as long as the Azure app supports personal Microsoft accounts in its supported account types setting. A tenant-only app will reject personal accounts during authorization.

Why are emails sent but not received?

Microsoft accepted the mail, so check Junk folders, quarantine and message trace. Then confirm SPF, DKIM and DMARC for your domain include Microsoft 365 so receivers trust the messages.

Sources

  1. Microsoft 365 / Outlook.com mailer WP Mail SMTP
  2. WP Mail SMTP plugin WordPress.org Plugins
  3. Register an application Microsoft Learn
  4. Enable or disable SMTP AUTH in Exchange Online Microsoft Learn
  5. wp_mail() WordPress Developer Resources

Is your product missing, or something out of date?

Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.

About the editors

Written and checked byWPLegible Editorial Team Independent WordPress reviews and guides

Researched from the primary sources listed above and checked against our editorial rules before publishing.