I was create sample email sender using c# but it shows an error is:
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.
System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
mail.To.Add("toAddress@gmail.com");
mail.From = new MailAddress("fromAddress@gmail.com", "Test Mail !", System.Text.Encoding.UTF8);
mail.Subject = "Test Mail";
mail.SubjectEncoding = System.Text.Encoding.UTF8;
mail.Body = "Test message";
mail.BodyEncoding = System.Text.Encoding.UTF8;
mail.IsBodyHtml = true;
mail.Priority = MailPriority.High;
SmtpClient client = new SmtpClient();
client.Credentials = new System.Net.NetworkCredential("myMail@gmail.com", "password");
client.Port = 587;
client.Host = "smtp.gmail.com";
client.EnableSsl = true;
client.UseDefaultCredentials = true;
client.Send(mail);
Web config:
<system.net>
<mailSettings>
<smtp from="myMail@gmail.com">
<network host="smtp.gmail.com" password="password"
port="587" userName="myMail@gmail.com" />
</smtp>
</mailSettings>
</system.net>