In my earlier blog, we saw one possible cause database mail error due to SSL settings. Today we will learn about another Database Mail Error.
In this blog we would learn about another cause and the solution of the database mail error: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1. This specifically applied to Gmail accounts/SMTP Server.
After reading my blog, one of my blog readers contacted me and informed that even after changing the settings as per blog, the emails are still giving the same error.
He informed that he has created a new Gmail account and using that to send emails. Here was the exact message in the database mail log.
Date 6/30/2018 1:25:47 AM
Log Database Mail (Database Mail Log)
Log ID 8
Process ID 8388
Mail Item ID 4
Last Modified 6/30/2018 1:25:47 AM
Last Modified By sa_sqlauthority
Message
The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2018-06-30T01:25:47). Exception Message: Cannot send mails to mail server. (The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at).)
I double checked and found that SSL checkbox was checked. I asked him to check his mailbox in Gmail to check if there is an email. Interestingly, we saw below email
So, Google was thinking that it’s a malicious attack and hence blocked their email via google server.
WORKAROUND/SOLUTION
The email also contained below link to fix the problem.
https://myaccount.google.com/lesssecureapps
Once we login to google account, we should see below.
All you need is turn that on and try sending email again. It worked for my client.
Do you know any other problems like this? Please share via comments and help others.
Reference: Pinal Dave (https://blog.sqlauthority.com)
First appeared on SQL SERVER – Database Mail Error: The SMTP Server Requires a Secure Connection or the Client Was Not Authenticated. The Server Response Was: 5.5.1 – Using Gmail