This topic is locked

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

6/22/2019 7:17:03 AM
ASPRunner.NET General questions
J
joejvgasprunner author

I finished an application that uses button events in List and View Pages to email selected and viewed table records. Using the instructions in the ASP Runner documentation worked perfectly. Installation of a certificate required research as I wanted to use port 587 with TLS. Instructions for that are at https://www.instructables.com/id/Installing-an-SSL-Certificate-in-Windows-7/ and ASP Runner Misc changes are as documented except port 587 is used.
After adding the event code for the buttons and testing it locally I uploaded another build of the application to the production server from my local environment and decided to test the email again on the production server. It failed with the message:
SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.
Being familiar with the message, I decided to check the password but it was correct. After a lot of head scratching I was checking my GMail and noticed an email from GMail telling me a security violation occurred from an unknown device; the location and time indicated it was the production server test. After a lot of digging I found this post at https://stackoverflow.com/questions/20906077/gmail-error-the-smtp-server-requires-a-secure-connection-or-the-client-was-not/26709761#26709761 which had very good information and one item stood out:
https://myaccount.google.com/lesssecureapps?pli=1
After allowing less secure apps and also reviewing and resolving all the messages in the security settings at https://myaccount.google.com/security'>https://myaccount.google.com/security email is now working on my local and production environments.
However, DO NOT LEAVE THIS SETTING ON as any third party application can access your account and possibly hack it by using brute force on your user name and password. Turn it off when finished and ensure your local and production environment server devices are allowed access using the correct method at https://myaccount.google.com/security'>https://myaccount.google.com/security where you can see which devices are allowed access, which applications, etc. plus displaying security alerts. This is only to be used for debugging and testing. It appears the production server access as an unknown device triggered something where my local device also no longer had access since the email worked fine locally before I tested it on the production server.
Hopefully, this post uncovers some of the additional issues you may encounter using the GMAIL SMTP server and also the need to be familiar with accessing the GMail security settings for your GMail account.

Pete K 6/24/2019

I've never encountered this issue but I appreciate your detailed information on how to managed to work it out. This could help others facing this issue.