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

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


Type: SystemString
The user account name on the server.
Type: SystemString
The password of the user account on the server.
Type: MailBeeAuthenticationMethods
A set of authentication methods which can be used when logging in a mailbox.
Type: MailBeeAuthenticationOptions
Specifies the options which affect login process.
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.
MailBeeExceptionAn error occurred and ThrowExceptions is true.

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.

This sample connects to a POP3 server and attempts to log in a user account using SASL NTLM method in Integrated Windows Authentication mode (passing credentials of the currently logged Windows user) even if NTLM is not listed in the server capabilities (the server may still support NTLM while not advertizing this). Use of other authentication methods is not allowed by this sample (they do not support obtaining the current Windows user's credentials and thus will raise exception is empty credentials are supplied by the caller).
// 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.Login(null, null, AuthenticationMethods.SaslNtlm, 
    AuthenticationOptions.TryUnsupportedMethods, null);
See Also