Exchange Connection Problems

Fix C# SMTP Authentication Errors in Exchange Online

Kushani NimanthikaKushani Nimanthika Nov 18, 2026 868 views

Question details

The user needs to authenticate a C# application when sending mail through Exchange Online SMTP.

Fix C# SMTP Authentication Errors in Exchange Online
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.
Before you start

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.

Solution 1Recommended

Check the Exchange Online SMTP connection settings

Use these settings to establish a secure client SMTP submission connection before troubleshooting credentials.

1
Set the server and port

In the C# application's SMTP configuration, set the server to smtp.office365.com and the port to 587.

2
Enable STARTTLS

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.

3
Check the account and sender

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.

4
Retry and inspect the response

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.

Check the Exchange Online SMTP connection settings
Use STARTTLS on port 587: Do not configure this connection as implicit SSL on port 465; Exchange Online client SMTP submission uses STARTTLS on port 587.
Free Microsoft Office alternative

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.

Free, lightweight tools for everyday document workCompatible with Microsoft Word, Excel, and PowerPoint formats, including DOCX, XLSX, and PPTXFamiliar interface that helps make document migration easierEdit documents related to your application or support workflow
microsoft office alternative - wps office

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.