Saturday, July 9, 2011

Send Email in asp.net

Following are the code to send email in asp.net using smtp client:

SmtpClient client = new SmtpClient();
client.EnableSsl = true;
client.Host = "smtp.gmail.com";
client.Port = 587;
client.Credentials=new System.Net.NetworkCredential("nileshviradiya@gmail.com", "password");
client.Send("nileshviradiya@gmail.com", "nileshviradiya1988@yahoo.com", "Let's eat lunch!", "Lunch at the Steak House?");

No comments:

Post a Comment