ImapLoggedIn Event
Occurs when the component successfully authenticates the user on the server and logs in the user account.

Namespace: MailBee.ImapMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax
public event LoggedInEventHandler LoggedIn

Value

Type: MailBeeLoggedInEventHandler
Remarks
Usually, this event is raised on successful completion of Login(String, String, String, String, AuthenticationMethods, AuthenticationOptions, SaslMethod) method call. However, it's also raised when the server authenticates the client automatically (by external means, such as if the client connects from the trusted IP address) and sends PREAUTH response.
Examples
This sample connects to the IMAP4 server and logs in the user account. The sample also checks if the IsLoggedIn status was set to true after calling Connect(String, Int32, Socket, EndPoint). This is required to make sure the client has not already been authenticated via PREAUTH.
using System;
using MailBee;
using MailBee.ImapMail;

class Sample
{
    private static string accountName = "Preauthenticated user";

    // LoggedIn event handler.
    private static void OnLoggedIn(object sender, LoggedInEventArgs e)
    {
        Console.WriteLine("Logged in as " + accountName);
    }

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

        // Subscribe to the LoggedIn event.
        imp.LoggedIn += new LoggedInEventHandler(OnLoggedIn);

        // Connect to the server. It's possible the server will automatically
        // authenticate us in some cases. In other samples, we do not check
        // if the auto-login occurred but real-world applications should check this.
        imp.Connect("imap4.somedomain.com");

        if (!imp.IsLoggedIn)
        {
            // Authenticate the user via Login()
            accountName = "jdoe";
            imp.Login(accountName, "secret");
        }

        imp.Disconnect();
    }
}
See Also