I wrote a sending email in asp.net and I get this error. I don't Know how to solve it
The error :
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.
The code :MailMessage msg = new MailMessage();
msg.From = new MailAddress(TextBox1.Text, "RUW Sport Center");
msg.To.Add(new MailAddress (TextBox3.Text));
msg.Subject = (TextBox4.Text);
msg.Body = TextBox5.Text;
msg.IsBodyHtml = true;
SmtpClient sc = new SmtpClient();
sc.Host = "smtp.gmail.com";
sc.Port = 25;
sc.Credentials = new NetworkCredential(TextBox1.Text, TextBox2.Text);
sc.EnableSsl = true;
sc.Send(msg);
Msgbx("Mail Send");
Munesh SharmaPosted May 11, 2015, 1:05 AM
Aditya MishraPosted May 11, 2015, 1:02 AM
this error occured due to security setting in gmail. go to security settings at the followig linkhttps://www.google.com/settings/security/lesssecureapps and enable less secure apps . So that you will be able to login from all apps.
Manoj BhoirPosted May 11, 2015, 1:00 AM
When you try to send mail from code and you find the error "The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required", than the error might occur due to following cases.
Case 1: when the password is wrong
Case 2: when you try to login from some App
Case 3: when you try to login from the domain other than your time zone/domain/computer
(This is the case in most of scenarios when sending mail from code)
Please check this link :
Gmail Error :The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required
http://stackoverflow.com/questions/20906077/gmail-error-the-smtp-server-requires-a-secure-connection-or-the-client-was-not
Anubhav ChaudharyPosted May 11, 2015, 12:45 AM
http://www.c-sharpcorner.com/UploadFile/cd7c2e/send-bulk-mails-using-smtp-configuration-part-2/
Dipankar BiswasPosted May 11, 2015, 12:03 AM
check it..http://www.smarterasp.net/support/kb/a1546/send-email-from-gmail-with-smtp-authentication-but-got-5_5_1-authentication-required-error.aspx