Email sending - ASP.NET

Sending email in ASP.NET using System.Net.Mail.

try
{
SmtpClient client = new SmtpClient();
client.Credentials = new NetworkCredential("username", "password");//Here is your mail server's any username and password.
client.Host = "smtp.test.com";// Your mail server's smtp host address.
client.Send("fromAddress@test.com", "itvinoth83@gmail.com", "mail by Vinoth", "Test Mail");
}
catch (SmtpException ex)
{
Response.Write("SendEMail: " + ex.Message);
}

No comments: