Fix C# SMTP Office 365 Authentication and Send Errors
Question details
A developer is unable to send emails via a C# application using SmtpClient through smtp.office365.com using port 587 and explicit credentials.

- Product
- Microsoft Office 365
- Device & OS
- not provided
- Scenario
- Attempting to send programmatic emails from a custom C# .NET application using an Office 365 mailbox.
- Observed behavior
- The application fails to authenticate or send emails through the Office 365 SMTP server, despite providing correct explicit credentials and utilizing STARTTLS.
Ensure you have administrator access to the Microsoft 365 admin center to verify tenant-level settings, and confirm you are using a licensed mailbox with a valid password.
Verify SMTP AUTH Status and Test in Outlook
Ensure that SMTP AUTH is enabled for the specific mailbox and verify the credentials by logging in directly.
Microsoft 365 disables SMTP AUTH by default for many tenants to improve security. If your code uses SmtpClient, this setting must be explicitly enabled for the sending account.
Go to the Microsoft 365 admin center and navigate to Users > Active users.
Select the user account being used for SMTP authentication. Click on the Mail tab and select 'Manage email apps'.
Ensure that the 'Authenticated SMTP' option is checked, then save your changes.
Log into Outlook on the web with the exact same credentials to verify the account is active, not blocked, and requires no immediate password resets.

Verify TLS Version and Port Configurations in C#
Ensure your application enforces TLS 1.2 and points to the correct Microsoft 365 endpoint.
Looking for a Reliable Office Alternative? Try WPS Office
While troubleshooting backend Microsoft 365 email integrations can be complex, handling daily documents shouldn't be. WPS Office is a lightweight, fully compatible, and free alternative to Microsoft Office.

Frequently Asked Questions
Why does my C# SmtpClient throw an authentication exception with Office 365?
This typically occurs because SMTP AUTH is disabled on the mailbox, the Microsoft 365 tenant has Security Defaults blocking basic authentication, or Multi-Factor Authentication (MFA) is enabled on the account without an App Password.
Should I continue using SmtpClient for new C# applications?
Microsoft currently recommends using the Microsoft Graph API instead of SmtpClient for sending emails in modern applications due to enhanced security, modern authentication support (OAuth 2.0), and better reliability.
What TLS version is strictly required for Office 365 SMTP?
Office 365 strictly requires TLS 1.2 or higher. Connections attempting to use TLS 1.0 or 1.1 will be rejected by the Exchange Online servers.




