0

Below is my code using smtp for sending mail.

MailMessage mm = new MailMessage("user@gmail.com", "user@gmail.com");
mm.Subject = "test";
mm.Body = "hi";
SmtpClient smtp = new SmtpClient("smtp.gmail.com",587);
smtp.Credentials = new NetworkCredential { UserName = "user@gmail.com", Password = "" };
smtp.EnableSsl = true;
smtp.Send(mm);

when am trying to execute this code i got the below error, smtp error

please help me to resolve this error..

Thanks in Advance,

Joest
  • 158
  • 6
  • Below my code, MailMessage mm = new MailMessage("user@gmail.com", "user@gmail.com"); mm.Subject = "test"; mm.Body = "hi"; SmtpClient smtp = new SmtpClient("smtp.gmail.com",587); smtp.Credentials = new NetworkCredential { UserName = "user@gmail.com", Password = "" }; smtp.EnableSsl = true; smtp.Send(mm); – S. Durgadevi May 16 '21 at 05:14

1 Answers1

1

Try the following:

Joest
  • 158
  • 6