I got this following error “The SMTP server requires a secure connection or the client was not authenticated. The server response was:5.5.1 authentication Required” while attempting to send mail using asp.net c# (i.e Google authentication required).
Solution to gmail server error:
Case 1:Please enter the correct password!. Otherwise,It may happen SMTP server error, due to the invalid password.
Case 2: Google may block the sign in attempt due modern security standards. You need to enable the following features. Login into your google account and go to:
If you want to use, turn on the less secure access.
c# send mail coding,
using (MailMessage mail = new MailMessage())
mail.From = new MailAddress("EMAILID@gmail.com"); //secureserver email settings
mail.To.Add("email@example.com"); //sender emailID
mail.Subject = "Greetings";
mail.Body = "<h1>Welcome User</h1>";
mail.IsBodyHtml = true;
using (SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587))
smtp.Credentials = new System.Net.NetworkCredential("EMAILID@gmail.com", "password"); //secureserver settings
smtp.EnableSsl = true;