sending Emails to the gmail ..
i am using below code ..
public static void SendEmail(string emailbody)
{
// Specify the from and to email address
MailMessage mailMessage = new MailMessage("[email protected]", "[email protected]");
// Specify the email body
mailMessage.Body = emailbody;
// Specify the email Subject
mailMessage.Subject = "Exception";
// Specify the SMTP server name and post number
SmtpClient smtpClient = new SmtpClient("smtp.gmail.com", 587);
// Specify your gmail address and password
smtpClient.Credentials = new System.Net.NetworkCredential()
{
UserName = "[email protected]",// my mailid
Password = "*******"// my current password
};
// smtpClient.EnableSsl = true;
// SmtpServer.EnableSsl = true;
// Finall send the email message using Send() method
smtpClient.EnableSsl = true;
smtpClient.Send(mailMessage);
}
it shows the error {"The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication
Required. Learn more at"}


Guest UserRank #816 · 2.8K reputationPosted Dec 15, 2014, 5:26 AM EST
smtpClient.UseDefaultCredentials = false;
krishna angirekula59 reputationPosted Dec 15, 2014, 7:02 PM EST
Guest UserRank #816 · 2.8K reputationPosted Dec 15, 2014, 10:27 PM EST
Joginder BangerRank #360 · 7K reputationPosted Dec 15, 2014, 10:41 PM EST
https://www.google.com/settings/security/lesssecureapps
or
Very Strong Password is needed,
I changed my Account's Password to somthing like: %TGB6yhn^YHN5tgb and it works perfect.
Khargesh RajputRank #616 · 3.9K reputationPosted Dec 15, 2014, 10:48 PM EST
this link sollved this
http://www.mywindowshosting.com/support/KB/a1546/send-email-from-gmail-with-smtp-authentication-but.aspx
krishna angirekula59 reputationPosted Dec 16, 2014, 1:10 AM EST
Khargesh RajputRank #616 · 3.9K reputationPosted Dec 16, 2014, 1:26 AM EST
"Security"/"Account permission", click to the "Settings" button to enable the "Access for less secure apps"