MailKit - The server's SSL certificate could not be validated
-
אני מנסה לשלוח מייל מהקוד, שימוש בספריה של MailKit, ברשת בלי נטפרי עובד תקין והמייל נשלח. ברשת נטפרי אני מקבלת את השגיאה הבאה. מה אפשר לעשות?
Error Error sending mail. Exception: MailKit.Security.SslHandshakeException: An error occurred while attempting to establish an SSL or TLS connection.
The server's SSL certificate could not be validated for the following reasons:
• The server certificate has the following errors:
• The revocation function was unable to check revocation for the certificate.---> System.Security.Authentication.AuthenticationException: The remote certificate was rejected by the provided RemoteCertificateValidationCallback.
at System.Net.Security.SslStream.CompleteHandshake(SslAuthenticationOptions sslAuthenticationOptions)
at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](Boolean receiveFirst, Byte[] reAuthenticationData, CancellationToken cancellationToken)
at System.Net.Security.SslStream.AuthenticateAsClient(SslClientAuthenticationOptions sslClientAuthenticationOptions)
at MailKit.Net.Smtp.SmtpClient.ConnectAsync(String host, Int32 port, SecureSocketOptions options, Boolean doAsync, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at MailKit.Net.Smtp.SmtpClient.ConnectAsync(String host, Int32 port, SecureSocketOptions options, Boolean doAsync, CancellationToken cancellationToken)
at NLog.MailKit.MailTarget.ProcessSingleMailMessage(IList`1 events) -
@dmn אני לא מכיר את הספריה, אבל אולי הלינקים הבאים יעזרו:
https://github.com/jstedfast/MailKit/issues/1251#issuecomment-940078832
https://github.com/jstedfast/MailKit/issues/511
https://github.com/jstedfast/MailKit/issues/1243