SMTP server requires a secure connection 5.5.1 AUTHENTICATION REQUIRED
The SMTP server requires a secure connection or the client was not authenticated. 5.5.1 Authentication Required
Post 2016, Gmail has been introducing several security features within its mail settings, which is preventing remote mail servers from sending out email via application codes. Now, this is resulting in the error ‘5.5.1 Authentication Required‘ below when you try and send an email via application code like.NET where you are using
SMTP Hostname: ‘smtp.gmail.com’
password: *your password*
The SMTP server requires a secure connection or the client was not authenticated. 5.5.1 Authentication Required. Learn more at”
Step 1: You will have to Login to your gmail account once from the browser of the production server. This will add exception for login to google and you will be allowed to login from code.
Step 2: You have to enable login from other timezone / ip for your google account.
To do this follow the link https://g.co/allowaccess and allow access by clicking the continue button.
Step 3: Turn On Access For Less Secure Apps. Visit link: https://www.google.com/settings/security/lesssecureapps
You can get the .NET code here,