ASP.NET TIPS: SENDING EMAIL USING ASP.NET (GMAIL OR YOUR SERVER)
using System.Net.Mail;
using System.Net;
MailMessage mail = new MailMessage();
mail.To.Add("**@gmail.com");
mail.To.Add("**@gmail.com");
mail.From = new MailAddress("**@gmail.com");
mail.Subject = "Email using Gmail";
string Body = "Hi, this mail is to test sending mail from devenvexe" +
"using Gmail in ASP.NET";
mail.Body = Body;
mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com"; //Or Your SMTP Server Address
smtp.Credentials = new System.Net.NetworkCredential
("***@gmail.com", "******");
//Or your Smtp Email ID and Password
smtp.EnableSsl = true;
smtp.Send(mail);
using System.Net;
MailMessage mail = new MailMessage();
mail.To.Add("**@gmail.com");
mail.To.Add("**@gmail.com");
mail.From = new MailAddress("**@gmail.com");
mail.Subject = "Email using Gmail";
string Body = "Hi, this mail is to test sending mail from devenvexe" +
"using Gmail in ASP.NET";
mail.Body = Body;
mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com"; //Or Your SMTP Server Address
smtp.Credentials = new System.Net.NetworkCredential
("***@gmail.com", "******");
//Or your Smtp Email ID and Password
smtp.EnableSsl = true;
smtp.Send(mail);
0 Comments