How to send email by ASP.Net C#
MailMessage msgMail = new MailMessage();
msgMail.To = txtTo.Text;
msgMail.From = txtFrom.Text;
msgMail.Cc = txtCc.Text;
msgMail.Subject = "Test Email";
msgMail.Body = txtName.Text + ", " +
txtComments.Text;
msgMail.Priority = MailPriority.High;
//SmtpMail.SmtpServer = "localhost";
try{
SmtpMail.Send(msgMail);
Response.Write("Your Email has been sent sucessfully -
Thank You");
}
catch (Exception exc){
Response.Write("Send failure: " + exc.ToString());
}