please help me to solve
error->Additional information: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.
my code is like below
- [HttpPost]
- public ViewResult Index(mail_sending.Models.MailModel _objModelMail)
- {
- if (ModelState.IsValid)
- {
- MailMessage mail = new MailMessage();
- mail.To.Add(_objModelMail.To);
- mail.From = new MailAddress(_objModelMail.From);
- mail.Subject = _objModelMail.Subject;
- string Body = _objModelMail.Body;
- mail.Body = Body;
- mail.IsBodyHtml = true;
- SmtpClient smtp = new SmtpClient();
- smtp.Host = "smtp.gmail.com";
- smtp.Port = 587;
- smtp.UseDefaultCredentials = false;
- smtp.Credentials = new System.Net.NetworkCredential("[email protected]", "shushiladevi"); // Enter seders User name and password
- smtp.EnableSsl = true;
- smtp.Send(mail);
- return View("Index", _objModelMail);
- }
- else
- {
- return View();
- }
- }

Amit GuptaPosted Jan 24, 2018, 5:04 AM
Khushboo KumariPosted Jan 24, 2018, 6:32 AM
Rajeesh MenothPosted Jan 24, 2018, 5:46 AM
Srikant MaruwadaPosted Jan 24, 2018, 5:27 AM