Bhautik Moradiya

Bhautik Moradiya

  • NA
  • 81
  • 10.8k

For Solve My Small Error

Dec 25 2017 5:49 AM
Hello I am Bhautik,
 
I am getting Error at smtp.Send(mm) so Please give me solution.
 
using (MailMessage mm = new MailMessage(txtemail.Text,"[email protected]"))
{
mm.Subject = "Your Details";
mm.Body = " Thanks for Visiting;
mm.IsBodyHtml = false;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.EnableSsl = true;
NetworkCredential NetworkCred = new NetworkCredential("[email protected]", "abc");
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Port = 587;
smtp.Send(mm);
ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Email sent.');", true);
}

Answers (2)