Mono Support SMTP SSL certifications 

Viewed 36012 time(s), 2 post(s), 7/19/2013 7:38:01 AM - by ruslanruslan
7/19/2013 7:47:13 AM
123 Reputation 15 Total posts

Hi!
I've got problem with my SMTP server. This server is used by Exchange server, that is why it includes ssl certifications.
Using this demo code is to say that it wouldn't work until i'll uncomment server certificate row:

 SmtpClient SmtpServer = new SmtpClient();
            MailMessage mail = new MailMessage();
            mail.From = new MailAddress("qwe@qwe.com");
            mail.Sender = new MailAddress("qwe@qwe.com");
            mail.To.Add("qwe@yandex.ru");
            mail.Subject = "new";
            mail.Body = "Report";
            SmtpServer.DeliveryMethod = SmtpDeliveryMethod.Network;
            SmtpServer.Port = 587;
            SmtpServer.UseDefaultCredentials = true;
            SmtpServer.Credentials = new NetworkCredential("DC.local\\qwe", "P@qwe");
           SmtpServer.EnableSsl = true;
            try
            {
              // ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; };
               SmtpServer.Send(mail);
            }

The problem is that I don't know how to use MonoX with this SMTP server. How can I specify certification settings in web.config or some wear else just to let MonoX successfully send messages?

1
7/22/2013 7:26:16 AM
15993 Reputation 2214 Total posts

Hi,

as I mentioned in previous post

you will have to build your own mail send functionality in order to add custom functionality. I can provide you with code snippets but you will have to let me know where do you want to include the above code ?
You will have to build your own mail sender if you plan to use this from code or you can set this via web.config as explained on MSDN,

Regards

2
This is a demo site for MonoX. Please visit Mono Software for more info.