Logs in a mail account on the IMAP4 server.
true if a login attempt succeeded; otherwise, false.
Use this overload if you need to authenticate with NTLM and GSSAPI (usually, against MS Exchange or MS IIS) and need to explicitly specify user domain or custom SPN. For other cases, you can use simpler overloads.
| Exception Type | Condition |
|---|---|
| MailBeeException | An error occurred and ThrowExceptions is true. |
This sample connects to an IMAP4 server and attempts to log in a user account using SASL GSSAPI method in Integrated Windows Authentication mode and NTLM is selected as the underlying implementation because targetName is an empty string.
[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("", null, null, null, AuthenticationMethods.SaslGssApi, AuthenticationOptions.TryUnsupportedMethods, null); 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("", Nothing, Nothing, Nothing, AuthenticationMethods.SaslGssApi, AuthenticationOptions.TryUnsupportedMethods, Nothing) imp.Disconnect()
Imap Class | MailBee.ImapMail Namespace | Imap.Login Overload List | SaslMethod