
September 29, 2010 12:14 by
The code below will allow you to send email to smtp.gmail.com . this works when you setup your domail to be hosted by google or if you have a Gmail account.
using System.Net.Mail;
using System.Net;
try
{
SmtpClient smtpClient = new SmtpClient("smtp.gmail.com",587);
smtpClient.EnableSsl = true;
smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
smtpClient.Credentials = new NetworkCredential("username@yourdomain.com", "password");
MailMessage message = new MailMessage(from, to, subject, body);
smtpClient.Send(message);
}
catch (Exception ex)
{
throw ex;
}
a0790228-7c1d-4937-a0fb-4702028a24ae|3|3.7