protected void btnSendEmail_Click(object sender, EventArgs e)
{
MailMessage mail = new MailMessage();
mail.To.Add("saurabhjnumca@gmail.com");
mail.To.Add("saurabh_singh_jnu06@yahoo.co.in");
mail.From = new MailAddress("sandeepjnumca@gmail.com");
mail.Subject = "HI this is a test mail for learners using .Net";
string Body = "Hi Friends, this mail is a test mail"+
"sending this mail through Gmail in ASP.NET";
mail.Body = Body;
mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.Credentials = new System.Net.NetworkCredential ("sandeepjnumca@gmail.com","GmailPassword");
smtp.EnableSsl = true;
smtp.Send(mail);
}
{
MailMessage mail = new MailMessage();
mail.To.Add("saurabhjnumca@gmail.com");
mail.To.Add("saurabh_singh_jnu06@yahoo.co.in");
mail.From = new MailAddress("sandeepjnumca@gmail.com");
mail.Subject = "HI this is a test mail for learners using .Net";
string Body = "Hi Friends, this mail is a test mail"+
"sending this mail through Gmail in ASP.NET";
mail.Body = Body;
mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.Credentials = new System.Net.NetworkCredential ("sandeepjnumca@gmail.com","GmailPassword");
smtp.EnableSsl = true;
smtp.Send(mail);
}