What about this,
public void SendEmail(string from, string to, string subject, string body)
{
string host = "smtp.gmail.com";
int port = 587;
MailMessage msg = new MailMessage(from, to, subject, body);
SmtpClient smtp = new SmtpClient(host, port);
string username = "example@gmail.com";
string password = "password";
smtp.Credentials = new NetworkCredential(username, password);
smtp.EnableSsl = true;
smtp.UseDefaultCredentials = false;
try
{
smtp.Send(msg);
}
catch (Exception ex)
{
}
}
-KR