Gmail Exception - The SMTP server requires a secure connection or the client was not authenticated.


Scenario:

Often is the case that you will want to send email through one of your web-sites. For most of us, we'll choose a free service like GMAIL to send through. In order to stop spam Google will periodcally throw exceptions that it requires a human to go clean up. Here is one such exception:

The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required

You may also receive this error message via e-mail.

Hi Blake,

Someone recently used your password to try to sign in to your Google Account xxxxxxxxxxx@gmail.com. This person was using an application such as an email client or mobile device.

We prevented the sign-in attempt in case this was a hijacker trying to access your account. Please review the details of the sign-in attempt:

Monday, December 1, 2014 5:32:47 PM UTC IP Address: xx.xx.xxx.xx Location: Unknown

If you do not recognize this sign-in attempt, someone else might be trying to access your account. You should sign in to your account and reset your password immediately.

Reset password

If this was you, and you are having trouble accessing your account, complete the troubleshooting steps listed at http://support.google.com/mail?p=client_login

Sincerely, The Google Accounts team

In this case, my web server on Azure is in the central time zone and my actual time zone is eastern. Google sees this as a problem unless you specifically tell it that both logins were from you. In order to do this you either have to login from the box or review you activity and accept each instance. Since I can't login from Azure I had to follow this link:

On that screen, login with the account that you are using to make your SMTP connection via code. You will then see all devices that have tried to connect, go to each one that is yours and tell it that it's Ok. Note, you will be wanting to look for the connection attempt from your web server (Azure in my case). That should do the trick in most cases.

Leave a comment

Please note that we won't show your email to others, or use it for sending unwanted emails. We will only use it to render your Gravatar image and to validate you as a real person.