When a Microsoft 365 mailbox rejects an application with 535 5.7.139 Authentication unsuccessful, SmtpClientAuthentication is disabled for the Tenant or a similar 535 5.7.3 message, authenticated SMTP client submission is switched off at the organisation level or on that mailbox. An administrator can enable it for a specific mailbox with Set-CASMailbox -SmtpClientAuthenticationDisabled $false, or for the tenant with Set-TransportConfig -SmtpClientAuthenticationDisabled $false, after which the application can submit through smtp.office365.com on port 587 with STARTTLS.
That is the mechanical fix, but it is rarely the whole story. Microsoft is retiring Basic authentication for SMTP client submission in Exchange Online, with dates that have been revised before, so enabling it is best treated as a bridge while you move to OAuth or another sending route. This guide shows how to diagnose, enable, test and plan.
What client submission is and why it is often off
Client submission, also called authenticated SMTP or SMTP AUTH, lets an application log in to a Microsoft 365 mailbox and send as that user through smtp.office365.com. Because it historically depended on a username and password alone, it is a favourite target for password spraying and for attackers who steal credentials, so Microsoft and many administrators disable it unless a specific workload needs it. Newer tenants commonly have it off by default, security defaults can block legacy authentication, and some organisations disable it deliberately through policy.
There are several layers, and any one of them can produce the same error. The effective setting for a mailbox is the per-mailbox value if one is set, otherwise the organisation value. Conditional Access and security defaults are separate controls that can block the sign-in even when SMTP AUTH is enabled. For the choice between this route and the alternatives, see Office 365 SMTP relay, Direct send and SMTP AUTH: which to use.
Read the error before you change anything
| Error text (abridged) | What it usually means | Where to look |
|---|---|---|
| 535 5.7.139 SmtpClientAuthentication is disabled for the Tenant | The organisation setting disables SMTP AUTH | Transport config, then mailbox setting |
| 535 5.7.3 Authentication unsuccessful | Wrong password, MFA blocking Basic auth, or a policy block | Sign-in logs, MFA state, Conditional Access |
| 535 5.7.139 user is locked by security defaults | Security defaults block legacy authentication | Entra ID security defaults and Conditional Access |
| 5.7.57 Client not authenticated to send mail | The client did not authenticate or the mailbox is not permitted | Client config and the mailbox setting |
The exact numbers and wording vary, and Microsoft documents them in its Exchange Online and Microsoft Entra pages, so match your message against that documentation. The classification of 5xx codes in general is covered in SMTP bounce codes explained, and the generic 535 behaviour in 535 authentication failed.
Check the current state with PowerShell
Connect to Exchange Online with the Exchange Online PowerShell module and an account that has the right admin role. Then read the settings:
Connect-ExchangeOnline
# Organisation-wide setting
Get-TransportConfig | Format-List SmtpClientAuthenticationDisabled
# Setting for one mailbox (blank means: follow the organisation setting)
Get-CASMailbox -Identity [email protected] | Format-List SmtpClientAuthenticationDisabledRead the result carefully. If the organisation value is True and the mailbox value is blank, SMTP AUTH is off for that user. If the mailbox value is False, the mailbox override enables it even when the organisation value is True. That override is the safest pattern.
Enable SMTP AUTH for one mailbox (preferred)
Enable it only for the accounts that need it, ideally a dedicated service mailbox with a strong unique password, instead of loosening the whole tenant.
Set-CASMailbox -Identity [email protected] -SmtpClientAuthenticationDisabled $falseIn the admin center the same switch is available per user: open the Microsoft 365 admin center or the Exchange admin center, select the user, open the mail settings for email apps and tick Authenticated SMTP. The menu labels change as Microsoft updates the portals, so treat these as search terms and confirm in the current documentation. Changes can take some time to apply, so wait before concluding that it did not work.
Enable it for the whole organisation (use with care)
Set-TransportConfig -SmtpClientAuthenticationDisabled $falseThis permits SMTP AUTH for every mailbox that does not have its own override, which widens your attack surface. If you do this, restrict who can use it, require strong passwords, monitor sign-ins, and plan to revert after migration to a better route. To undo it:
Set-TransportConfig -SmtpClientAuthenticationDisabled $trueTest the connection
swaks --server smtp.office365.com --port 587 --tls \
--auth LOGIN --auth-user [email protected] --auth-password 'YOUR_PASSWORD' \
--from [email protected] --to [email protected]A 235 2.7.0 Authentication successful means SMTP AUTH is working for that mailbox. If you still see 535, check these in order: the password, whether multi-factor authentication is required for the account, security defaults, and Conditional Access policies that block legacy protocols. Under multi-factor authentication, plain Basic authentication to SMTP generally fails unless the tenant has a supported alternative such as app passwords, which Microsoft itself discourages. See testing an SMTP connection.
Other settings that must match
| Item | Required value |
|---|---|
| Server | smtp.office365.com |
| Port | 587 |
| Encryption | STARTTLS (not implicit TLS on 465 for this endpoint) |
| Username | The full mailbox address (UPN) |
| From address | The authenticated mailbox, or an address the mailbox has Send As permission for |
| TLS version | A current TLS version; very old clients may fail the handshake |
| Throttling | Exchange Online applies per-mailbox sending limits that Microsoft documents and changes |
Microsoft documents this endpoint with port 587 and STARTTLS. Do not assume that settings from other providers apply. The broader settings are in Microsoft 365 SMTP settings.
Plan beyond Basic authentication
Because Basic authentication for SMTP client submission is being retired, check the current timeline in the Microsoft 365 message center and the Exchange team's announcements. Your options:
- OAuth 2.0 for SMTP. The application obtains a token through Microsoft Entra ID and authenticates with the XOAUTH2 mechanism. This is the supported modern route for apps that send as a user. See SMTP OAuth 2.0.
- Microsoft Graph sendMail. Send through an API instead of SMTP, using application permissions where appropriate.
- Direct send or an SMTP relay connector. For devices and line-of-business apps that send to your own domain's mailboxes or from fixed IP addresses. Their restrictions differ, so read the comparison article.
- A dedicated sending service. For application and transactional mail, use a relay or API that is designed for it.
Security defaults, Conditional Access and MFA
Enabling the mailbox flag is necessary but not always sufficient. Three other controls commonly block the same sign-in. Security defaults in Microsoft Entra ID block legacy authentication protocols for the whole tenant. Conditional Access policies can block legacy authentication for selected users or apps. Per-user multi-factor authentication makes a password-only SMTP login fail, because the protocol cannot answer a second factor. If the error persists after the mailbox change, review the sign-in logs in the Entra admin center for the service account: the failure reason there is usually more specific than the SMTP response.
Do not disable security defaults across a tenant to make one script work. Create a narrowly scoped exception, or better, move the script to OAuth so that it does not need one. Document who owns each exception and when it will be removed, so temporary settings do not become permanent.
Security checklist
- Create a dedicated service mailbox per application and enable SMTP AUTH only there.
- Use long random passwords and store them in a secrets manager. See API key security and rotation for the same principles.
- Block interactive sign-in for the service account where policy allows, and watch its sign-in logs.
- Review which mailboxes have the override, and remove it when the workload moves.
- Publish SPF, DKIM and DMARC for the domain and verify with the SPF, DKIM and DMARC checker.
Next steps
Read the error, check the two PowerShell values, enable authenticated SMTP for the narrowest scope, test and then schedule the migration to OAuth, Graph or a dedicated sending service. For rejections related to reputation instead of authentication, see Outlook and Microsoft 365 blocks.
Moving application mail off a mailbox? Use a dedicated relay on smtp.migosmtp.com or the REST email API instead of a user mailbox.
References and further reading
Frequently asked questions
Why does Microsoft 365 say SmtpClientAuthentication is disabled for the Tenant?
Authenticated SMTP client submission is switched off at the organisation level. An administrator can enable it for a mailbox with Set-CASMailbox or for the tenant with Set-TransportConfig.
Which server and port does Microsoft 365 SMTP use?
smtp.office365.com on port 587 with STARTTLS, authenticating with the full mailbox address.
Is it safe to enable SMTP AUTH for the whole organisation?
It widens exposure to password attacks. Enable it per mailbox for the specific service account instead, and plan a move to OAuth.
Why does 535 5.7.3 continue after I enable SMTP AUTH?
Common causes are a wrong password, multi-factor authentication blocking Basic auth, security defaults or Conditional Access blocking legacy sign-in.
What replaces Basic authentication for SMTP?
OAuth 2.0 for SMTP, Microsoft Graph sendMail, a connector for devices, or a dedicated sending service.