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

Namespace: MailBee.ImapMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 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.ImapMail;
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)
    {
        Imap imp = new Imap();

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

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

        imp.Connect("imap.company.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.
        imp.Login("jdoe", "secret");

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

        imp.Disconnect();
    }
}
See Also