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);

0 Comments

Featured Post

How to learn Azure without paid subscription

Microsoft Azure is a cloud service that is constantly expanding to help your organization meet business challenges. You can build, manage d...

Subscribe to the FREE Weekly Newsletter to receive all the latest Microsoft Azure, AI, Xamarin

Popular Posts