警告:请勿在生产代码中使用此功能!
解决方法是,您可以关闭证书验证。只有这样做才能获得由于证书错误而引发错误的确认。
在调用之前调用此方法
smtpclient.Send():
[Obsolete("Do not use this in Production pre!!!",true)] static void NEVER_EAT_POISON_Disable_Certificatevalidation() { // Disabling certificate validation can expose you to a man-in-the-middle attack // which may allow your encrypted message to be read by an attacker // https://stackoverflow.com/a/14907718/740639 ServicePointManager.ServerCertificatevalidationCallback = delegate ( object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors ) { return true; }; }


