ImapLoggedIn Event |
Namespace: MailBee.ImapMail
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(); } }