Pop3Login Method (String, String, AuthenticationMethods) |
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 accountName,
string password,
AuthenticationMethods authMethods
)
Public Function Login (
accountName As String,
password As String,
authMethods As AuthenticationMethods
) As Boolean
Parameters
- accountName
- Type: SystemString
The user account name on the server. - 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.
Return Value
Type:
Booleantrue if a login attempt succeeded; otherwise,
false.
Exceptions Remarks
Authentication methods are tried from more secure to less secure. If
authMethods
is set to
Auto, 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.
Note |
---|
See OAuth2 topic on how to use the modern OAuth 2.0 authentication (e.g. with Office 365). |
Examples This sample connects to a POP3 server and logs in a user account
using secure authentication methods only. Use of insecure methods is not allowed.
using MailBee;
using MailBee.Pop3Mail;
Pop3 pop = new Pop3();
pop.Connect("mail.domain.com");
pop.Login("jdoe", "secret",
AuthenticationMethods.Apop | AuthenticationMethods.SaslCramMD5 | AuthenticationMethods.SaslNtlm);
pop.Disconnect();
Imports MailBee
Imports MailBee.Pop3Mail
Dim pop As New Pop3
pop.Connect("mail.domain.com")
pop.Login("jdoe", "secret", _
AuthenticationMethods.Apop Or AuthenticationMethods.SaslCramMD5 Or AuthenticationMethods.SaslNtlm)
pop.Disconnect()
See Also