OutgoingEmailAuthenticationError error appears in Dynamics 365 mailbox alert

Applies to: Dynamics 365 Customer Engagement Online

Symptom


An alert with a message like the following appears in a Dynamics 365 mailbox:

"Email cannot be sent for mailbox "Your mailbox is now connected to Dynamics 365" because either a server certificate needed to connect to the email server could not be validated or the credentials used to send email are incorrect or do not provide access. Mailbox "Your mailbox is now connected to Dynamics 365" didn't synchronize. A notification about this is posted on the alerts wall for the owner of the email server profile [Profile Name].

Email Server Error Code: OutgoingEmailAuthenticationError"

If you click Details, the following additional information appears:

ActivityId: [GUID]
>Error : MailKit.Security.AuthenticationException: 535: 5.7.8 Username and Password not accepted. Learn more at
5.7.8  https://support.google.com/mail/?p=BadCredentials x9sm13491053pgt.66 - gsmtp ---> MailKit.Net.Smtp.SmtpCommandException: 5.7.8 Username and Password not accepted. Learn more at
5.7.8  https://support.google.com/mail/?p=BadCredentials x9sm13491053pgt.66 - gsmtp
   --- End of inner exception stack trace ---
   at MailKit.Net.Smtp.SmtpClient.<AuthenticateAsync>d__65.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MailKit.Net.Smtp.SmtpClient.Authenticate(Encoding encoding, ICredentials credentials, CancellationToken cancellationToken)
   at MailKit.MailService.Authenticate(Encoding encoding, String userName, String password, ...

Cause


This error can occur if you are using a POP3/SMTP email server profile configured for Gmail. 

Resolution


Try following the steps from the following Gmail article:

 https://support.google.com/mail/?p=BadCredentials