Click or drag to resize
MimeKit

MailServiceServerCertificateValidationCallback Property

Get or sets a callback function to validate the server certificate.

Namespace:  MailKit
Assembly:  MailKit (in MailKit.dll) Version: 2.3.0
Syntax
C#
public RemoteCertificateValidationCallback ServerCertificateValidationCallback { get; set; }

Property Value

Type: RemoteCertificateValidationCallback
The server certificate validation callback function.

Implements

IMailServiceServerCertificateValidationCallback
Remarks

Gets or sets a callback function to validate the server certificate.

This property should be set before calling any of the Connect methods.

Examples
C#
using (var client = new SmtpClient ()) {
    client.ServerCertificateValidationCallback = (s, c, h, e) => true;

    client.Connect ("smtp.gmail.com", 465, SecureSocketOptions.SslOnConnect);

    client.Authenticate ("username", "password");

    client.Send (message);

    client.Disconnect (true);
}
See Also