Logs in a mail account on the IMAP4 server.
true if a login attempt succeeded; otherwise, false.
This method will try to authenticate using the best (the most secure) authentication method supported by the server, but will downgrade to less secure methods (to the simplest "LOGIN account password" authentication in the worst case) if better methods are not available.
Note If SafeMode is true, MailBee will use the simplest "LOGIN account password" authentication by default. This can often help to troubleshoot login problems (many mail servers implement secure authentication methods incorrectly).
| Exception Type | Condition |
|---|---|
| MailBeeException | An error occurred and ThrowExceptions is true. |
This sample connects to an IMAP4 server, logs in a user account, selects Inbox folder, and displays the total number of messages in this folder.
[C#] // To use the code below, import MailBee namespaces at the top of your code. using MailBee; using MailBee.ImapMail; // The actual code (put it into a method of your class). Imap imp = new Imap(); imp.Connect("mail.domain.com"); imp.Login("jdoe", "secret"); imp.SelectFolder("INBOX"); Console.WriteLine(imp.MessageCount + " message(s) in inbox"); imp.Disconnect();
[Visual Basic] ' To use the code below, import MailBee namespaces at the top of your code. Imports MailBee Imports MailBee.ImapMail ' The actual code (put it into a method of your class). Dim imp As New Imap imp.Connect("mail.domain.com") imp.Login("jdoe", "secret") imp.SelectFolder("INBOX") Console.WriteLine(imp.MessageCount & " message(s) in inbox") imp.Disconnect()
Imap Class | MailBee.ImapMail Namespace | Imap.Login Overload List