Pop3Login Method (String, String, String, String, AuthenticationMethods, AuthenticationOptions, SaslMethod) |
Logs in a mailbox on the POP3 server.
Namespace: MailBee.Pop3MailAssembly: MailBee.NET (in MailBee.NET.dll) Version: 12.4 build 677 for .NET 4.5
Syntax public bool Login(
string targetName,
string domain,
string accountName,
string password,
AuthenticationMethods authMethods,
AuthenticationOptions authOptions,
SaslMethod authUserDefined
)
Public Function Login (
targetName As String,
domain As String,
accountName As String,
password As String,
authMethods As AuthenticationMethods,
authOptions As AuthenticationOptions,
authUserDefined As SaslMethod
) As Boolean
Parameters
- targetName
- Type: SystemString
The Service Principal Name (SPN) of the POP3 server. Only used with GSSAPI authentication method.
If an empty string, NTLM method will be used for GSSAPI. If a null reference (Nothing in Visual Basic),
MailBee will autodetect SPN as "POP3/serverName" and use Kerberos for GSSAPI. If set to a non-empty string, MailBee will also select Kerberos for GSSAPI and use this value as SPN. - domain
- Type: SystemString
The user account domain on the server. Only used with NTLM and GSSAPI authentication methods. You can leave it a null reference to use the current domain. - accountName
- Type: SystemString
The user account name on the server (can be empty for NTLM and GSSAPI). - password
- Type: SystemString
The password of the user account on the server. - authMethods
- Type: MailBeeAuthenticationMethods
A set of authentication methods which can be used when logging in a mailbox. - authOptions
- Type: MailBeeAuthenticationOptions
Specifies the options which affect login process. - authUserDefined
- Type: MailBeeSaslMethod
A reference to the instance of user defined authentication method,
or a null reference (Nothing in Visual Basic) if user defined authentication is not used.
Return Value
Type:
Booleantrue if a login attempt succeeded; otherwise,
false.
Exceptions Remarks By default, MailBee won't even try to use authentication methods which are not
listed by the server in its capabilities. This behavior can be changed by setting
TryUnsupportedMethods bit in authOptions.
If, during the authentication attempt, the server reports that the method is unsupported,
MailBee will try the next method in authMethods until the compatible
method is found or no more methods left. This behavior can be changed by setting
UseSingleMethodOnly bit in authOptions.
Authentication methods are tried from more secure to less secure. If authMethods
is set to Auto and authOptions is
None, MailBee will try to use the most secure method
supported by the server but will downgrade to less secure methods (to the simplest
USER/PASS authentication in the worst case) if better methods are not available.
Examples This sample connects to a POP3 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.
using MailBee;
using MailBee.Pop3Mail;
Pop3 pop = new Pop3();
pop.Connect("mail.domain.com");
pop.Login("", null, null, null, AuthenticationMethods.SaslGssApi,
AuthenticationOptions.TryUnsupportedMethods, null);
pop.Disconnect();
Imports MailBee
Imports MailBee.Pop3Mail
Dim pop As New Pop3
pop.Connect("mail.domain.com")
pop.Login("", Nothing, Nothing, Nothing, AuthenticationMethods.SaslGssApi, _
AuthenticationOptions.TryUnsupportedMethods, Nothing)
pop.Disconnect()
See Also