Deliverability

535 5.7.3 Authentication unsuccessful: Microsoft 365 OAuth fix

535 5.7.3 Authentication unsuccessful on Microsoft 365 OAuth SMTP means Exchange Online rejected your XOAUTH2 login. Usual causes: a token for the wrong resource, a service principal never registered in Exchange, missing mailbox permission, or SMTP AUTH disabled. Decode the token first, then work down the list.

Sohail HussainSohail Hussain10 min read

Short answer

  • Exchange Online accepted the connection but rejected your XOAUTH2 login. The usual causes are a token requested for the wrong resource, a service principal registered with the wrong Object ID, missing mailbox permission, or SMTP AUTH turned off.
  • Decode the token first, then check the Exchange service principal, the mailbox permission and the SMTP AUTH setting, in that order.

You connect to smtp.office365.com, send AUTH XOAUTH2 with a valid-looking token, and get this back:

535 5.7.3 Authentication unsuccessful

The message is deliberately vague. It does not say whether the token was bad, aimed at the wrong service, or fine but attached to an identity with no rights on the mailbox. The sections below separate those cases.

Why it happens

535 is the standard SMTP reply for failed authentication, and 5.7.3 is the enhanced status code. The failure happens on the sending side of the handshake, so no message was accepted and no recipient is involved.

For OAuth SMTP, the common causes are:

  1. The token was requested for the wrong resource. A Microsoft Graph token is valid, but not for SMTP. Microsoft's documentation says you must use https://outlook.office365.com/.default as the scope in the token request for the client credentials flow.
  2. The service principal was registered with the wrong ID. Microsoft states the Object ID must come from the Enterprise Application, not the App Registration, and that using the incorrect Object ID will cause an authentication failure.
  3. The service principal has no permission on the mailbox. Registering it in Exchange is not enough; it also needs access to the specific mailbox.
  4. SMTP AUTH is disabled. Microsoft says if security defaults is enabled in your organization, SMTP AUTH is already disabled in Exchange Online. A tenant-wide or per-mailbox setting can also turn it off.
  5. The XOAUTH2 string is malformed, or the token has expired.

I can't tell you which of these is yours from the error alone; nobody can. Users on Microsoft's Q&A forum report the same 535 5.7.3 even after following the documentation, and the resolutions vary by tenant. Work through the fixes in order.

Step-by-step fixes

Fix 1: decode the token and compare it to the table

Paste your access token into a JWT decoder (Microsoft's jwt.ms works) and read these claims.

ClaimWhat you wantIf it's wrong
audAn Exchange Online resource, not GraphRequest the right scope (Fix 2)
roles (app-only flow)Contains SMTP.SendAsAppAdd the permission and grant admin consent
scp (delegated flow)Contains SMTP.SendAdd the scope to the token request
expA time in the futureRequest a fresh token

Access tokens are short-lived. A token you cached this morning can fail this afternoon with the same generic error, so request a fresh one per connection or refresh before expiry.

Fix 2: request the right scope

  1. For app-only (client credentials), request https://outlook.office365.com/.default.
  2. For delegated (a user signs in), request https://outlook.office.com/SMTP.Send. Microsoft lists this as the permission scope string for SMTP AUTH. Add offline_access if you need refresh tokens.
  3. Call your tenant-specific token endpoint, with your tenant ID in the URL, rather than /common, for client credentials.
  1. Open your app registration and go to API permissions > Add a permission > APIs my organization uses.
  2. Search for Office 365 Exchange Online and choose Application permissions.
  3. Expand SMTP and select SMTP.SendAsApp, then Add permissions.
  4. Have a tenant admin grant admin consent.

Do not pick Graph Mail.Send for this; it is a different API.

Fix 4: register the service principal in Exchange with the right Object ID

Microsoft's documentation says the tenant admin must register your Entra application's service principal in Exchange via Exchange Online PowerShell.

Connect-ExchangeOnline -Organization {tenant-id}
New-ServicePrincipal -AppId {application-client-id} -ObjectId {enterprise-app-object-id}
Get-ServicePrincipal | fl

Take {enterprise-app-object-id} from the Overview page of the app under Enterprise applications in the Microsoft Entra admin center. The Object ID on the App registrations page is a different GUID and will not work.

Two different IDs

You use one ID when creating the Exchange service principal and a different one when granting mailbox permissions. Microsoft's page says so explicitly, and mixing them up is the most common reason a correct-looking setup still returns 535.

Fix 5: grant the service principal access to the mailbox

Run this with the service principal identifier returned by Get-ServicePrincipal:

Add-MailboxPermission -Identity "sender@example.com" -User {service-principal-id} -AccessRights FullAccess

If your app sends as the mailbox, Microsoft notes you also need SendAs for the client credentials flow, using Add-RecipientPermission. Allow some time for permission changes to take effect, and retest before changing anything else.

Fix 6: turn on SMTP AUTH for the mailbox and check the tenant

Check the mailbox setting:

Get-CASMailbox -Identity "sender@example.com" | Format-List SmtpClientAuthenticationDisabled
Set-CASMailbox -Identity "sender@example.com" -SmtpClientAuthenticationDisabled $false

Microsoft documents the values like this: False means enabled, True means disabled, and blank means use the organization setting. The mailbox setting takes precedence over the tenant setting.

Then check the tenant:

Get-TransportConfig | Format-List SmtpClientAuthenticationDisabled

In the Microsoft 365 admin center you can also check Users > Active users, select the user, then Mail > Manage email apps, and look at Authenticated SMTP. Some admins report that this checkbox is missing in newer tenants; the PowerShell route is the reliable one.

Security defaults and Conditional Access can block the sign-in before Exchange sees it. Look at the Entra sign-in logs for your app.

Fix 7: check the XOAUTH2 string and the connection

The string is user=, the mailbox's primary SMTP address, a 0x01 byte, auth=Bearer , the token, then two 0x01 bytes, all base64-encoded. The separator is the byte 0x01, not the characters caret and A. Most libraries handle this; hand-built strings are where whitespace or a missing trailing separator creeps in. Also confirm that user is the mailbox you granted permission on.

Connect to smtp.office365.com on port 587 with STARTTLS, then send:

AUTH XOAUTH2 {base64-string}

Fix 8: test outside your app

Take your code out of the equation with a tool such as swaks:

swaks --server smtp.office365.com --port 587 --tls \
  --auth XOAUTH2 --auth-user sender@example.com --auth-password "ACCESS_TOKEN" \
  --from sender@example.com --to test@example.com

If swaks succeeds, your tenant setup is fine and the bug is in how your app builds the string or refreshes tokens. If swaks also fails with 535, go back to Fixes 3 to 6.

Cause, symptom and fix at a glance

CauseWhat you seeFix
Wrong scopeaud points to GraphUse the Outlook scope (Fix 2)
No SMTP.SendAsApp consentroles claim is emptyFix 3
Wrong Object IDToken looks right, still 535Re-register with the Enterprise app ID (Fix 4)
No mailbox permission535 only for some mailboxesFix 5
SMTP AUTH off535 for every tokenFix 6
Expired tokenWorked earlier, fails nowRequest a new token

Two permission models

One answer on Microsoft's Q&A forum reports a case where the SMTP.SendAsApp permission and an RBAC-for-applications setup were both active, and removing SMTP.SendAsApp fixed it. That is a community report, not Microsoft's documented guidance. Try it only if you deliberately use RBAC for applications and everything else checks out.

Checklist before you try again

  • The token's aud points to Exchange Online, and roles or scp carries the SMTP permission.
  • An admin granted consent for SMTP.SendAsApp.
  • New-ServicePrincipal used the Enterprise application Object ID.
  • The service principal has FullAccess (and SendAs if needed) on the sending mailbox.
  • SmtpClientAuthenticationDisabled is False on the mailbox, and not forced to True at the tenant level with no override.
  • Security defaults and Conditional Access are not blocking the app.
  • The token is fresh, and user= is the mailbox's primary SMTP address.

If nothing works

Open a support request through the Microsoft 365 admin center, or ask your Exchange admin to. Include:

  • the UTC timestamp of a failed attempt
  • the sending mailbox
  • the tenant ID and application ID
  • the SMTP transcript with the token redacted
  • the decoded token claims (aud, roles or scp, exp)
  • the output of Get-ServicePrincipal and Get-CASMailbox
Subject: 535 5.7.3 Authentication unsuccessful on smtp.office365.com with OAuth (XOAUTH2)

Hello,

AUTH XOAUTH2 to smtp.office365.com:587 (STARTTLS) fails with
"535 5.7.3 Authentication unsuccessful".

Tenant ID: {tenant-id}
Application (client) ID: {app-id}
Enterprise app Object ID: {object-id}
Mailbox: sender@example.com
Last failure (UTC): {timestamp}
Flow: client credentials, scope https://outlook.office365.com/.default

Already verified: token aud and roles claims, New-ServicePrincipal done,
FullAccess granted, SmtpClientAuthenticationDisabled = False.

Please confirm what blocks the login on the Exchange Online side.

Where Mailneo fits

This error comes from your own SMTP-with-OAuth code or script, and Mailneo can't change your tenant settings, grant admin consent or register service principals. If your goal is to send campaigns from a Microsoft 365 mailbox, Mailneo connects Outlook and Microsoft 365 accounts by OAuth, and you can test the connection after adding it (see the email accounts documentation). Your admin may still need to allow the app in your tenant, and Mailneo can't recover a suspended Microsoft account or override Microsoft's sending limits.

Common questions

Is 535 5.7.3 the same as 5.7.57 or 5.7.139?

No. They are different enhanced codes. Microsoft's guidance lists 535 5.7.3 and 5.7.57 together as common SMTP AUTH errors, with SMTP AUTH being disabled and MFA, security defaults or Conditional Access blocking the login as the first things to check. Match the exact code before applying a fix.

Does Basic authentication still work for SMTP AUTH?

Do not count on it. Microsoft says it disabled SMTP AUTH in all tenants where it wasn't being used, and recommends OAuth for new work. Check Microsoft's current Exchange Online documentation for the exact status of your tenant as of November 2026.

Can the token be valid and still fail?

Yes. A token can be signed correctly and unexpired but still fail if its audience is wrong, the service principal is unregistered, or the mailbox permission is missing. That is why the claims check comes first.

Do I need Mailneo to fix this?

No. The fix is entirely in Entra and Exchange Online. Mailneo only matters if you wanted to send campaigns through that mailbox rather than run your own SMTP code.

For reference, Microsoft's pages used here are Authenticate an IMAP, POP or SMTP connection using OAuth and Enable or disable SMTP AUTH in Exchange Online.

deliverabilitymicrosoft-365-oauth-smtperror-codes
Share this article
Sohail Hussain

Sohail Hussain

Founder & CEO at Mailneo

Building Mailneo — AI-powered email marketing for growing businesses.

Related Articles

Deliverability

0x800ccc0e: Outlook Unable to Connect to SMTP Server, Fixed

Outlook error 0x800ccc0e means the app could not open a connection to your outgoing (SMTP) server. Usually the port, encryption setting or password is wrong, or antivirus, a firewall or your ISP is blocking it. Set port 587 with STARTTLS, turn on SMTP authentication, and test again.

Sohail Hussain|10 min read
Deliverability

SocketLabs "421 4.5.1 Too many errors" blacklist: how to fix it

`421 4.5.1 Too many errors, you have been temporarily blacklisted` means a SocketLabs server saw repeated auth or bad-address errors from your IP and paused it. Stop whatever is retrying, fix credentials and invalid recipients, clear the queue, and wait. The block usually lifts within minutes, but returns if retries resume.

Sohail Hussain|9 min read
Deliverability

421-4.7.0 Gmail Has Detected This Message Is Suspicious: Fix

The 421-4.7.0 "suspicious due to the nature of the content and/or the links" error means Gmail's content filter rejected your message after DATA, not an authentication check. Remove click tracking or move it to your own domain, drop URL shorteners, check link reputation, then retest with a plain message.

Sohail Hussain|10 min read
Deliverability

421 4.7.0 IP not in whitelist for RCPT domain: what it means

The error 421 4.7.0 IP not in whitelist for RCPT domain means the recipient's mail gateway, usually Mimecast in reports, only accepts connections from approved IPs, and the Google sending IP isn't on that list. The fix is on the recipient side: their admin must allow the IPs or change the mail routing.

Sohail Hussain|9 min read

Ready to supercharge your email marketing?

Start sending smarter emails with AI-powered campaigns. No credit card required.

Get Started Free