Apps, scripts and devices that send mail through smtp.office365.com with a username and password stop working when Basic authentication is switched off in your tenant. Microsoft switches it off by default at the end of December 2026. Here is how to find what still uses it and move each sender to OAuth or Microsoft Graph.
| When | What happens |
|---|---|
| Until December 2026 | No change: SMTP AUTH with Basic authentication still works where it works today. |
| End of December 2026 | Basic authentication for SMTP AUTH is disabled by default in existing tenants. Admins can still turn it back on. |
| Tenants created after December 2026 | Basic authentication for SMTP AUTH is unavailable by default; OAuth is the supported method. |
| Second half of 2027 | Microsoft announces the final removal date. |
SMTP AUTH itself stays: only signing in with a password goes away. Turning Basic authentication back on is a stop-gap until the final removal date, not a fix; a Microsoft staff member replying in the comments under the Exchange Team's post (November 19, 2026) says Microsoft will share the exact procedure.
smtp.office365.com or smtp-legacy.office365.com with a username and password: C# apps on System.Net.Mail.SmtpClient with a NetworkCredential, PowerShell scripts with Send-MailMessage, web forms, website mail plug-ins, monitoring and alerting tools, scanners and printers.550 5.7.30 Basic authentication is not supported for Client Submission.smtp.office365.com, SmtpClient, NetworkCredential and Send-MailMessage.Each sender lands in one of three groups below: code you own, a vendor's product (ask the vendor for an OAuth version) or a device.
Exchange Online accepts OAuth 2.0 tokens on SMTP AUTH through SASL XOAUTH2. System.Net.Mail.SmtpClient has no XOAUTH2 support, so .NET code moves to a library that has it, such as MailKit.
https://outlook.office.com/SMTP.Send instead.Connect-ExchangeOnline
New-ServicePrincipal -AppId <APPLICATION_ID> -ObjectId <ENTERPRISE_APP_OBJECT_ID>
Add-MailboxPermission -Identity "alerts@contoso.com" -User <SERVICE_PRINCIPAL_ID> -AccessRights FullAccess
The Object ID comes from the Enterprise applications entry, not from App registrations; the wrong one makes sign-in fail. To send as another address, the sender also needs SendAs (Add-RecipientPermission).https://outlook.office365.com/.default and authenticate with XOAUTH2:
using MailKit.Net.Smtp;
using MailKit.Security;
using Microsoft.Identity.Client;
var app = ConfidentialClientApplicationBuilder.Create(clientId)
.WithTenantId(tenantId)
.WithCertificate(certificate) // a certificate, not a password
.Build();
var token = await app
.AcquireTokenForClient(new[] { "https://outlook.office365.com/.default" })
.ExecuteAsync();
using var smtp = new SmtpClient();
await smtp.ConnectAsync("smtp.office365.com", 587, SecureSocketOptions.StartTls);
await smtp.AuthenticateAsync(new SaslMechanismOAuth2("alerts@contoso.com", token.AccessToken));
await smtp.SendAsync(message); // a MimeKit MimeMessage
await smtp.DisconnectAsync(true);A rejected token ends with 535 5.7.3 Authentication unsuccessful; check the scope, the consent and the service principal registration first.
If you'd rather drop SMTP altogether, Microsoft Graph sends mail over HTTPS: POST /users/{id}/sendMail with the Mail.Send application permission. Don't grant Mail.Send tenant-wide in Microsoft Entra ID (remove it if it's already granted): there it lets the app send as any user in the tenant. Give it through RBAC for Applications in Exchange Online instead: an Exchange admin registers the app's service principal, as in option A, and assigns it the Application Mail.Send role scoped to the mailboxes it may send from. Microsoft says the two kinds of grants add up, so if Mail.Send is also granted in Entra ID, the scope restricts nothing.
var graph = new GraphServiceClient(
new ClientCertificateCredential(tenantId, clientId, certificate));
await graph.Users["alerts@contoso.com"].SendMail.PostAsync(new SendMailPostRequestBody
{
Message = new Message
{
Subject = "Nightly job finished",
Body = new ItemBody { ContentType = BodyType.Text, Content = "All good." },
ToRecipients = new List<Recipient>
{
new() { EmailAddress = new EmailAddress { Address = "ops@contoso.com" } }
}
},
SaveToSentItems = false
});
In PowerShell, Microsoft marks Send-MailMessage as obsolete and says PowerShell has no immediate replacement for it; for Exchange Online, its documentation says you can use Send-MgUserMail from the Microsoft Graph PowerShell SDK.
Graph is also where EWS code has to go. Since October 1, 2026, Microsoft has been switching EWS off by default, in stages, in Exchange Online tenants that didn't choose to keep it on, and on April 1, 2027 EWS is switched off for good. If the same app uses both, move them together: see our EWS to Microsoft Graph guide.