0

After creating a profile and account using gmail account smtp.gmail.com port 587 I get an error while trying to send a test email

The mail could not be sent to the recipients because of the mail server failure. Cannot send mail to mail servers(The SMTP server requires secure connection or the client was not authenticated).

enter image description here

Command for sending

EXEC msdb.dbo.sp_send_dbmail
    @profile_name = 'Test Profile',  -- my profile name
    @recipients = 'myaddress@gmail.com',  -- my email address, the same one 
                                          -- which is also configured above
    @body = 'This is a test email sent from TEST server',
    @subject = 'TEST EMAIL',
    @importance ='HIGH' 

What I am doing wrong? Or should I change some settings from in my gmail account settings? Thanks

  • gmail is tricky, it has some security features in place that will block access if the connection looks fishy to them. If for example you are in a different continent than your server their heuristics could block the connection. I believe you should see that when you visit security.google.com/settings/security/activity from your account – Tom V Aug 28 '18 at 11:51
0

Basically your error message says what you have to focus on. As SSL is enabled make sure to set ON external unsafe application access in gmail setting and not to forget to refresh your account. If unsafe access is off, gmail will notify you by a message to assure that it is you trying to access and will show the way how to enable if you click yes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy