For Microsoft 365 (Office 365), set your app or device to smtp.office365.com, port 587, STARTTLS on, and log in with a licensed mailbox’s address and credentials. For Outlook.com and Hotmail, use smtp-mail.outlook.com on port 587 with OAuth2. The big change in 2026 is authentication: plain username and password logins are being switched off.
Office 365 SMTP settings
| Setting | Microsoft 365 (work or school) | Outlook.com, Hotmail, Live |
|---|---|---|
| SMTP server | smtp.office365.com |
smtp-mail.outlook.com |
| Port | 587 (recommended) or 25 | 587 |
| Encryption | STARTTLS, TLS 1.2 or 1.3 | STARTTLS |
| Username | Full mailbox address | Full address |
| Authentication | OAuth recommended, Basic auth ending | OAuth2 required |
| Limits | 10,000 recipients a day, 30 messages a minute | Personal account limits |
Sources: Microsoft’s multifunction device and application guide and Outlook.com POP, IMAP and SMTP settings.
Port 465 is not supported. Microsoft’s own tip: if a device recommends or defaults to 465, it does not support the TLS versions client SMTP submission requires.
Before it works: enable SMTP AUTH on the mailbox
SMTP AUTH is disabled for Microsoft 365 organizations created after January 2020. If your login fails with 5.7.139 Authentication unsuccessful, an admin needs to enable “Authenticated SMTP” for the sending mailbox in the Microsoft 365 admin center (Users, Active users, the user, Mail, Manage email apps).
Security defaults in Microsoft Entra ID also block Basic auth for SMTP. If your tenant has them on, only OAuth will work.
The end of Basic auth for SMTP AUTH
Microsoft’s updated timeline, published January 2026:
- Until December 2026: no change.
- End of December 2026: Basic auth for SMTP AUTH is disabled by default for existing tenants. Admins can turn it back on.
- New tenants after December 2026: Basic auth is unavailable by default. OAuth is the supported method.
- Second half of 2027: Microsoft announces the final removal date.
Once Basic auth is off, logins fail with 550 5.7.30 Basic authentication is not supported for Client Submission. Plan the move now, especially for printers and older line-of-business apps that cannot do OAuth.
Sending from C# to Office 365
Microsoft does not recommend System.Net.Mail.SmtpClient for new code and points to MailKit. With MailKit:
using MailKit.Net.Smtp;
using MailKit.Security;
using MimeKit;
var message = new MimeMessage();
message.From.Add(new MailboxAddress("Acme Alerts", "alerts@contoso.com"));
message.To.Add(MailboxAddress.Parse("sam@example.com"));
message.Subject = "Nightly report";
message.Body = new TextPart("plain") { Text = "The report is attached to the dashboard." };
using var client = new SmtpClient();
await client.ConnectAsync("smtp.office365.com", 587, SecureSocketOptions.StartTls);
// OAuth: pass an access token from Microsoft Entra ID
await client.AuthenticateAsync(new SaslMechanismOAuth2("alerts@contoso.com", accessToken));
await client.SendAsync(message);
await client.DisconnectAsync(true);
Getting accessToken means registering an app in Microsoft Entra ID and requesting the https://outlook.office.com/SMTP.Send permission. Microsoft documents the flow in Authenticate an IMAP, POP or SMTP connection using OAuth.
If the From address is not the mailbox you logged in as, that mailbox needs Send As permission, or the message bounces with 5.7.60 Client doesn't have permissions to send as this sender.
Office 365 SMTP relay and Direct Send
For devices that cannot authenticate at all, Microsoft offers two other paths. Both use your tenant’s MX host, which looks like contoso-com.mail.protection.outlook.com.
| SMTP relay (connector) | Direct Send | |
|---|---|---|
| Port | 25 | 25 |
| TLS | Enabled (1.2 or 1.3) | Optional |
| Authentication | Static IP or TLS certificate on an inbound connector | None |
| Sends to external recipients | Yes | No, internal only |
| Needs a licensed mailbox | No | No |
SMTP relay needs an inbound connector in the Exchange admin center (Mail flow, Connectors) that trusts your office’s static, unshared public IP or a certificate for your domain. It cannot be used from third-party clouds such as Azure VMs. Add the IP to your SPF record so receivers trust it.
Direct Send delivers only to mailboxes in your own tenant. Microsoft says most customers do not need it and is working on disabling it by default.
Microsoft also lists High Volume Email for internal recipients and Azure Communication Services Email for external recipients as replacements for Basic auth SMTP. The printer and scanner guide compares these for office devices.
Common Office 365 SMTP errors
| Error | Cause |
|---|---|
5.7.139 Authentication unsuccessful, SmtpClientAuthentication is disabled |
SMTP AUTH turned off for the tenant or mailbox |
5.7.139 ... user is locked by security defaults |
Security defaults block Basic auth |
550 5.7.30 Basic authentication is not supported |
Basic auth disabled, use OAuth |
5.7.60 Client doesn't have permissions to send as this sender |
From address differs from the login |
530 5.7.57 Client not authenticated to send mail |
No login, or login attempted without TLS, see this guide |
A simpler path for app email
Microsoft 365 is built for people’s mailboxes. Using one to send app email means a licensed mailbox, OAuth token handling, 30 messages a minute and no per-message delivery events.
A transactional relay is easier for apps and devices. Mailcandor’s SMTP relay takes a username (mailcandor) and an API key over TLS on 465 or 587. No OAuth registration, no mailbox license, and you can send from any address on a domain you have verified. Keep Microsoft 365 for staff mail and point the app at the relay.