Hi All,
I am trying to send an email in ASP.NET using system.net.mail
the problem is that the outgoing server requires a secure connection (SSL)
Does anyone know how I can implement this?
Thanks!
Hi All,
I am trying to send an email in ASP.NET using system.net.mail
the problem is that the outgoing server requires a secure connection (SSL)
Does anyone know how I can implement this?
Thanks!
Here's a sample with GMail which uses SSL:
class Program
{
static void Main(string[] args)
{
SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
client.EnableSsl = true;
client.Credentials = new NetworkCredential("[email protected]", "secret");
MailMessage mail = new MailMessage();
mail.From = new MailAddress("[email protected]");
mail.To.Add("[email protected]");
mail.Subject = "Test mail";
mail.Body = "test body";
client.Send(mail);
}
}