Pop3TlsStarted Event
Occurs when the connection with the server becomes secure.

Namespace: MailBee.Pop3Mail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax
public event TlsStartedEventHandler TlsStarted

Value

Type: MailBeeTlsStartedEventHandler
Remarks
This event is raised when TLS/SSL negotiation completes and TLS session successfully starts. Usually, this happens as a result of successful completion of StartTls method or if automatic TLS/SSL negotiation was requested via setting SslMode property to non-Manual value.
Examples
This console sample demonstrates that TlsStarted event is raised during executing Login(String, String, String, String, AuthenticationMethods, AuthenticationOptions, SaslMethod) method when SslMode property is set to UseStartTls value.
using System;
using MailBee;
using MailBee.Pop3Mail;
using MailBee.Security;

class Sample
{
    // TlsStarted event handler.
    private static void OnTlsStarted(object sender, TlsStartedEventArgs e)
    {
        // This will happen during Login method execution.
        Console.WriteLine("TLS/SSL session started.");
    }

    // The actual code.
    static void Main(string[] args)
    {
        Pop3 pop = new Pop3();

        // Subscribe to TlsStarted event.
        pop.TlsStarted += new TlsStartedEventHandler(OnTlsStarted);

        // Notify MailBee it should start TLS/SSL session when appropriate.
        // The connection is made to the regular port so that STLS command
        // will be used to start TLS/SSL session.
        pop.SslMode = SslStartupMode.UseStartTls;

        pop.Connect("mail.domain.com");

        Console.WriteLine("Connected to the server. Will login now...");

        // TLS/SSL negotiation will take place here. Thus, user credentials
        // will be sent to the mail server already under secure TLS/SSL layer.
        pop.Login("jdoe@domain.com", "secret");

        Console.WriteLine("Logged in successfully.");

        pop.Disconnect();
    }
}
See Also