Fix C# SMTP Authentication Errors in Exchange Online
Question details
The user needs to authenticate a C# application when sending mail through Exchange Online SMTP.

- Product
- Exchange Online SMTP and C# application
- Device & OS
- not provided
- Scenario
- A C# application sends mail successfully with other accounts but fails with an Outlook 365 account.
- Observed behavior
- The Exchange Online server rejects the application with an error indicating that the client was not authenticated to send mail.
Confirm that the account is an Exchange Online mailbox and collect the full SMTP error and response code. You may need an Exchange administrator to check tenant and mailbox authentication settings.
Check the Exchange Online SMTP connection settings
Use these settings to establish a secure client SMTP submission connection before troubleshooting credentials.
In the C# application's SMTP configuration, set the server to smtp.office365.com and the port to 587.
Configure the SMTP client to use STARTTLS and TLS 1.2 or later. If using System.Net.Mail.SmtpClient, set EnableSsl to true for STARTTLS on port 587.
In the application's SMTP settings, use the full mailbox email address for the account. If the From address is a different mailbox, verify that the account has the required Send As or Send on Behalf permission.
Send a test message from the application and record the complete SMTP response. If authentication still fails, check SMTP AUTH permissions and the authentication method.

Verify SMTP AUTH permissions and use OAuth
Use this solution when the secure connection is configured but Exchange Online still rejects authentication.
Work with Office documents in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for opening and editing Office documents. It can help you move document workflows with less friction, but it does not fix Exchange Online SMTP authentication.

Frequently Asked Questions
Which SMTP server and port should my C# app use for Exchange Online?
Configure smtp.office365.com on port 587 and enable STARTTLS. Use TLS 1.2 or later and authenticate with a permitted method.
How can I tell whether SMTP AUTH is disabled for a mailbox?
An Exchange administrator can run Get-CASMailbox -Identity user@domain.com | Format-List SmtpClientAuthenticationDisabled in Exchange Online PowerShell. A null value means the mailbox inherits the tenant setting.
Can System.Net.Mail.SmtpClient authenticate with OAuth?
System.Net.Mail.SmtpClient does not provide built-in OAuth authentication. Use an OAuth-capable library such as MailKit and configure an appropriate Exchange Online access token.
Why does sending from a different address fail?
The authenticated account may lack permission to use that From address. Ask an Exchange administrator to verify the required Send As or Send on Behalf permission for the sender mailbox.




