Pop3Login Method (String, String, String, String, AuthenticationMethods, AuthenticationOptions, SaslMethod)
Logs in a mailbox on the POP3 server.

Namespace: MailBee.Pop3Mail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
Syntax
public bool Login(
	string targetName,
	string domain,
	string accountName,
	string password,
	AuthenticationMethods authMethods,
	AuthenticationOptions authOptions,
	SaslMethod authUserDefined
)

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: Boolean
true if a login attempt succeeded; otherwise, false.
Exceptions
ExceptionCondition
MailBeeExceptionAn error occurred and ThrowExceptions is true.
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.
// To use the code below, import MailBee namespaces at the top of your code.
using MailBee;
using MailBee.Pop3Mail;

// The actual code (put it into a method of your class).
Pop3 pop = new Pop3();
pop.Connect("mail.domain.com");
pop.Login("", null, null, null, AuthenticationMethods.SaslGssApi, 
    AuthenticationOptions.TryUnsupportedMethods, null);
pop.Disconnect();
See Also