Pop3Login Method (String, String) |
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
)
Public Function Login (
accountName As String,
password As String
) 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.
Return Value
Type:
Booleantrue if a login attempt succeeded; otherwise,
false.
Exceptions Remarks This method will try to authenticate using the best (the most secure) authentication 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.
You can also force using a particular authentication method with Login(String, String, AuthenticationMethods) overload passing a method
like Regular.
Note |
---|
If SafeMode is true, MailBee will use the simplest USER/PASS authentication
by default (Regular option). This can often help to troubleshoot login problems (many mail servers implement
secure authentication methods incorrectly). |
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, logs in a user account, and displays
the total number of messages in an inbox.
using MailBee;
using MailBee.Pop3Mail;
Pop3 pop = new Pop3();
pop.Connect("mail.domain.com");
pop.Login("jdoe", "secret");
Console.WriteLine(pop.InboxMessageCount + " message(s) in inbox");
pop.Disconnect();
Imports MailBee
Imports MailBee.Pop3Mail
Dim pop As New Pop3
pop.Connect("mail.domain.com")
pop.Login("jdoe", "secret")
Console.WriteLine(pop.InboxMessageCount & " message(s) in inbox")
pop.Disconnect()
See Also