MailBee.NET Objects 3.1

Pop3.Login Method (String, String)

Logs in a mailbox on the POP3 server.

public bool Login(
   string accountName,
   string password
);

Parameters

accountName
The user account name on the server.
password
The password of the user account on the server.

Return Value

true if a login attempt succeeded; otherwise, false.

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.

Note   If SafeMode is true, MailBee will use the simplest USER/PASS authentication by default. This can often help to troubleshoot login problems (many mail servers implement secure authentication methods incorrectly).

Exceptions

Exception Type Condition
MailBeeException An error occurred and ThrowExceptions is true.

Example

This sample connects to a POP3 server, logs in a user account, and displays the total number of messages in an inbox.

[C#]
// 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("jdoe", "secret");
Console.WriteLine(pop.InboxMessageCount + " message(s) in inbox");
pop.Disconnect();
[Visual Basic]
' To use the code below, import MailBee namespaces at the top of your code.
Imports MailBee
Imports MailBee.Pop3Mail

' The actual code (put it into a method of your class).
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

Pop3 Class | MailBee.Pop3Mail Namespace | Pop3.Login Overload List