Problem
You might have received the following error message when you try to use Office 365 user mailbox account for SMTP client access to send emails.
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM [PSXP216CAXXXX.XXXXXX.PROD.OUTLOOK.COM]
Fix/Solution
In Exchange Online, by default, the SMTP Client Authentication will be disabled for all Office 365 mailbox accounts in a way to prevent users from using basic authentication. There are two kinds of settings to disable or enable the SMTP client authentication.
- An organization-wide setting to disable (or enable) SMTP AUTH.
- A per-mailbox setting that overrides the tenant-wide setting.
Verify the SMTP Auth status in your Tenant
After connecting Exchange Online PowerShell V2 module, run the following command to check the SMTP AUTH is globally disabled or not in your organization. If the SmtpClientAuthenticationDisabled property returns True
, then SMTP auth disabled, otherwise not disabled in tenant-wide.
Get-TransportConfig | Select SmtpClientAuthenticationDisabled
Verify the SMTP Auth status for a specific mailbox account
Run the following command to get the individual mailbox setting. You can replace your problematic mailbox in the command and check the output.
Get-CASMailbox -Identity [email protected] | Select SmtpClientAuthenticationDisabled
For the individual mailbox, The Null value indicates the setting for the mailbox is controlled by the global setting on the organization. The True indicates the SMTP auth is disabled and the False indicates the setting enabled to override the organization setting. The mailbox setting takes precedence over the organization setting.
Enables SMTP AUTH for the problematic mailbox
Once you have confirmed the issue occurred due to the disabled SMTP authentication in your problematic account. Then run the below command to enable SMTP Auth for your mailbox and check the case again.
Set-CASMailbox -Identity [email protected] -SmtpClientAuthenticationDisabled $false
Check and enable SMTP AUTH from Microsoft 365 admin center
Along with PowerShell, you can also Microsoft Admin center to view and enable the setting on a specific mailbox.
- Open Microsoft Office 365 Admin center
- In left-side, click Users > Active Users.
- Click on the required user to view Edit user UI.
- Click the Mail tab. In the Email apps section, click Manage email apps.
- Enable the option Authenticated SMTP and Save changes.
Other Possible Solutions
- Possible Reason 1: Ensure that you have provided the correct user credentials (User name and password).
- Possible Reason 2: Ensure that you have provided the same user account for both the Credential and From field.
- Possible Reason 3: If you want to send mail on behalf of another user, then ensure that the user account has required permissions (ex: SendAs or SendOnBehalf) for the account that you provided in From field.
- Possible Reason 4: If you face the issue with MFA enabled account, then you can generate an app password and then use an app password for that account, instead of the regular user password. Related thread: https://techcommunity.microsoft.com/t5/Identity-Authentication/Send-Mail-SMTP-through-Office-365-with-MFA/m-p/163867
- Possible Reason 5: Make sure that you have used the option –UseSSL if your SMTP server requires a secure connection.
1 thought on “Fix – The SMTP server requires a secure connection or the client was not authenticated”