Program to sending mail through
program
// program to send mail through program
protected void Button2_Click(object sender, EventArgs e)
{
System.Net.Mail.MailMessage MyMailMessage = new System.Net.Mail.MailMessage("deepak.sonu786@gmail.com", "ravan_raj1857@yahoo.com",
"This is the mail subject", "Just wanted to say Hello");
MyMailMessage.IsBodyHtml = false;
System.Net.NetworkCredential mailAuthentication = new
System.Net.NetworkCredential("deepak.sonu786@gmail.com", "deepudon");
System.Net.Mail.SmtpClient mailClient = new System.Net.Mail.SmtpClient("smtp.gmail.com", 587);
mailClient.EnableSsl = true;
mailClient.UseDefaultCredentials = false;
mailClient.Credentials = mailAuthentication;
mailClient.Send(MyMailMessage);
}
No comments:
Post a Comment