[Mono-aspnet-list] SMTP problem with gmail

angel colmenares angel.ignacio.colmenares at gmail.com
Wed Dec 7 12:37:33 EST 2011


this code works fine for me (using mono-mod_mono...);


try{
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
mail.From = new MailAddress("USERNAME at gmail.com");
mail.To.Add("DEST-USERMAIL at gmail.com");
mail.Subject = "testing  gmail - mono";
mail.Body = "This is for testing SMTP mail from GMAIL";
SmtpServer.Port = 587;
SmtpServer.Credentials = new System.Net.NetworkCredential("GMAIL-USERNAME",
"PASSWOR");
SmtpServer.EnableSsl = true;
ServicePointManager.ServerCertificateValidationCallback = delegate(object s,
X509Certificate certificate, X509Chain chain, SslPolicyErrors
sslPolicyErrors) { return true; };
SmtpServer.Send(mail);
}
catch(Exception e){
Console.WriteLine("Ouch!"+e.ToString());
}

--
View this message in context: http://mono.1490590.n4.nabble.com/SMTP-problem-with-gmail-tp4160046p4169823.html
Sent from the Mono - ASP.NET mailing list archive at Nabble.com.


More information about the Mono-aspnet-list mailing list