0

Getting error:

System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.

The code I used is given below:

using (MailMessage mail = new MailMessage())
            {
                mail.From = new MailAddress(email);
                mail.To.Add(email);
                mail.Subject = "Test";
                mail.Body = html;
                mail.IsBodyHtml = true;

                using (SmtpClient smtp = new SmtpClient(host, int.Parse(port)))
                {
                    smtp.UseDefaultCredentials = false;
                    smtp.Credentials = new NetworkCredential(email, password);
                    smtp.EnableSsl = true;
                    smtp.Send(mail);
                }
            }
Devi
  • 15
  • 1
  • 6

1 Answers1

0

Got it worked.....Issue was with the port number. Tried port number 25 and it worked....

Devi
  • 15
  • 1
  • 6