Sunday, May 19, 2013

ASP.NET Send Email with Gmail POP settings

ASP.NET Send Email with Gmail POP settings


MailMessage mail = new MailMessage();
mail.To.Add(MailTo);
mail.From = new MailAddress("noreply@abc.com"); // or could be @gmail.com
mail.Subject = "Comment/Question"
string Body =  "your text msg body;"
mail.Body = "Email message Body";
mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.Port = 587;
smtp.Credentials = new System.Net.NetworkCredential ("abc@gmail.com", "password");
smtp.EnableSsl = true;
smtp.Send(mail);



No comments:

Post a Comment