I\'m developing a mail client for a school project. I have managed to send e-mails using the SmtpClient in C#. This works perfectly with any server but it doesn
I started getting this with GMail in May 2013 after working for 6 momths. The Mono project's Using Trusted Roots Respectfully document provided guidance on work around. I chose option #1:
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
It is too disruptive to have e-mail for my service stop working without warning.
Update Aug 26 2016: user Chico suggested the following complete implementation of the ServerCertificateValidationCallback callback. I have not tested.
ServicePointManager.ServerCertificateValidationCallback = MyRemoteCertificateValidationCallback;
bool MyRemoteCertificateValidationCallback(System.Object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) {
bool isOk = true;
// If there are errors in the certificate chain, look at each error to determine the cause.
if (sslPolicyErrors != SslPolicyErrors.None) {
for (int i=0; i