Pop3SslCertificates Property |
Provides access to the client and server SSL certificate settings.
Namespace: MailBee.Pop3MailAssembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax public ClientServerCertificates SslCertificates { get; }
Public ReadOnly Property SslCertificates As ClientServerCertificates
Get
Property Value
Type:
ClientServerCertificatesA reference to the client and server SSL certificate settings.
Remarks The following code should be used to access the server certificate (assuming pop is
a Pop3 component instance): pop.SslCertificates.Server. To set the client
certificate, the developer should assign pop.SslCertificates.Client property.
Examples
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.Pop3Mail;
using MailBee.Security;
class Sample
{
static void Main(string[] args)
{
Pop3 pop = new Pop3();
pop.SslMode = SslStartupMode.OnConnect;
pop.SslCertificates.Client = new Certificate(@"C:\my.pfx", CertFileType.Pfx, "secret");
pop.Connect("mail.domain.com", 995);
Console.WriteLine("The server certificate info");
Console.WriteLine("===========================");
Console.WriteLine("Issued by: " + pop.SslCertificates.Server.IssuedBy);
Console.WriteLine("Issued to: " + pop.SslCertificates.Server.IssuedTo);
Console.WriteLine("Valid from: " + pop.SslCertificates.Server.ValidFromDate);
Console.WriteLine("Valid to: " + pop.SslCertificates.Server.ValidToDate);
pop.Disconnect();
}
}
Imports System
Imports MailBee
Imports MailBee.Pop3Mail
Imports MailBee.Security
Class Sample
Shared Sub Main(ByVal args() As String)
Dim pop As New Pop3
pop.SslMode = SslStartupMode.OnConnect
pop.SslCertificates.Client = New Certificate("C:\my.pfx", CertFileType.Pfx, "secret")
pop.Connect("mail.domain.com", 995)
Console.WriteLine("The server certificate info")
Console.WriteLine("===========================")
Console.WriteLine("Issued by: " & pop.SslCertificates.Server.IssuedBy)
Console.WriteLine("Issued to: " & pop.SslCertificates.Server.IssuedTo)
Console.WriteLine("Valid from: " & pop.SslCertificates.Server.ValidFromDate)
Console.WriteLine("Valid to: " & pop.SslCertificates.Server.ValidToDate)
pop.Disconnect()
End Sub
End Class
See Also