"An unknown error occurred while sending the email message" when testing a mailbox in Dynamics 365
This article provides a solution to an error that occurs when you try to test and enable a mailbox in Microsoft Dynamics 365.
Applies to: Microsoft Dynamics 365
Original KB number: 4092733
Symptoms
When you try to test and enable a mailbox in Microsoft Dynamics 365, you receive the following error:
An unknown error occurred while sending the email message "Your mailbox is now connected to Dynamics 365". Mailbox <Mailbox Name> didn't synchronize. The owner of the associated email server profile <Profile Name> has been notified.
If you select the Details section, you might find the following details:
Error : System.Net.Mail.SmtpException: Syntax error, command unrecognized. The server response was:
at System.Net.Mail.SmtpConnection.ConnectAndHandshakeAsyncResult.End(IAsyncResult result)
at System.Net.Mail.SmtpTransport.EndGetConnection(IAsyncResult result)
at System.Net.Mail.SmtpClient.ConnectCallback(IAsyncResult result)
Cause
This error can occur if the Outgoing Port value in the Advanced section of the email server profile isn't correct.
Resolution
To fix this issue, follow these steps:
Sign in to your Dynamics 365 organization with a user account that has the "System Administrator" role.
Navigate to Settings > Email Configuration, and then select Email Server Profiles.
Open the email server profile that's used by the mailbox receiving this error.
Note
You can also select the name of the email server profile in the error message. It appears as a hyperlink that will open the correct email server profile record.
Select Advanced.
Correct the Outgoing Port value and then select Save.
Note
Refer to the documentation from your email provider for the correct ports when connecting to the SMTP service. For example, for Gmail, use port 587 for TLS/STARTTLS connections.
Select Mailboxes, and then select the mailbox that received the error.
Select the Test & Enable Mailboxes button.
After the test is complete, open the mailbox record and view the Alerts section if the results don't appear as Success.