SmtpServerSslCertificates Property
Provides access to the client and server SSL certificate settings.

Namespace: MailBee.SmtpMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.2.0 build 630 for .NET 4.5
public ClientServerCertificates SslCertificates { get; }

Property Value

Type: ClientServerCertificates
A reference to the client and server SSL certificate settings.

The following code should be used to access the server certificate (assuming server is an SmtpServer class instance currently used by Smtp component as an SMTP server definition): server.SslCertificates.Server. To set the client certificate, the developer should assign server.SslCertificates.Client property.

Note Note
To use SSL certificates, your license key must include Security license. See Powerup class for details.
This console sample establishes secure connection with the mail server using the private certificate of the client and then displays various information about the server certificate. The client certificate is taken from a file (MailBee can also read certificates from the registry, see CertificateStore class description for details).
using System;
using MailBee;
using MailBee.SmtpMail;
using MailBee.Security;

class Sample
    static void Main(string[] args)
        Smtp mailer = new Smtp();
        SmtpServer server = new SmtpServer("");
        server.SslMode = SslStartupMode.UseStartTls;
        server.SslCertificates.Client = new Certificate(@"C:\my.pfx", CertFileType.Pfx, "secret");
        Console.WriteLine("The server certificate info");
        Console.WriteLine("Issued by:    " + server.SslCertificates.Server.IssuedBy);
        Console.WriteLine("Issued to:    " + server.SslCertificates.Server.IssuedTo);
        Console.WriteLine("Valid from:    " + server.SslCertificates.Server.ValidFromDate);
        Console.WriteLine("Valid to:    " + server.SslCertificates.Server.ValidToDate);
See Also