Hi
I am getting below error - Message = "The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Authentication Required. Learn more at"
Email.Body = BodyStr;
Email.BodyEncoding = Encoding.UTF8;
Email.IsBodyHtml = true;
Email.Priority = MailPriority.Normal;
SmtpClient sc = new SmtpClient(Result.SMTPHost, Convert.ToInt32(Result.SMTPPort));
sc.Credentials = new System.Net.NetworkCredential(Result.Email, "test");
sc.UseDefaultCredentials = false;
sc.EnableSsl = Convert.ToBoolean(Result.EnableSsl);
sc.Send(Email);
Thanks
Uday DodiyaPosted Oct 7, 2022, 5:47 AM
Sometimes google blocks the third party access, so you have to enable Less-Secure Sign In
Ramco RamcoPosted Oct 7, 2022, 4:29 AM
Hi Uttam
I tried but still same problem, Below is my code
Thanks
Uttam KumarPosted Oct 7, 2022, 4:21 AM
Google may block sign-in attempts from some apps or devices that do not use modern security standards. Since these apps and devices are easier to break into, blocking them helps keep your account safer.
Therefore, you have to enable Less Secure Sign-In (or Less secure app access) in your google account.
After signing into your Google account, go to:
https://www.google.com/settings/security/lesssecureapps
or
https://myaccount.google.com/lesssecureapps
In C#, you can use the following code:
Vishal YelvePosted Oct 6, 2022, 1:45 PM
Hi Ramco,
Please refer below link, hope this might help you.
https://www.aspsnippets.com/Articles/Send-email-using-Gmail-SMTP-Mail-Server-in-ASPNet.aspx
https://www.aspsnippets.com/Articles/GMAIL-Error-The-SMTP-server-requires-a-secure-connection-or-the-client-was-not-authenticated.aspx
Ramco RamcoPosted Oct 6, 2022, 1:42 PM
Hi Vishal
Below is the code but still same problem , Even in Gmail i have set Less secure App Access = "On".
Thanks
Vishal YelvePosted Oct 6, 2022, 1:35 PM
Try this, hope this will work
Ramco RamcoPosted Oct 6, 2022, 1:02 PM
Hi
Even then same error
Thanks
Vishal YelvePosted Oct 6, 2022, 12:35 PM
Hi Ramco,
try this by setting this