Attempts to establish an authenticated session with the server using the specified credentials.

Namespace: S22.Pop3
Assembly: S22.Pop3 (in S22.Pop3.dll) Version: 1.1.4653.26443 (1.1.0.0)

Syntax

C#
public void Login(
	string username,
	string password,
	AuthMethod method
)

Parameters

username
Type: System..::..String
The username with which to login in to the POP3 server.
password
Type: System..::..String
The password with which to log in to the POP3 server.
method
Type: S22.Pop3..::..AuthMethod
The requested method of authentication. Can be one of the values of the AuthMethod enumeration.

Examples

This example demonstrates how to authenticate with a POP3 server once a connection has been established. Notice that you can also connect and login in one step using one of the overloaded constructors.
CopyC#
/* Connect to Gmail's POP3 server on port 995 using SSL */
Pop3Client Client = new Pop3Client("pop.gmail.com", 995, true);

try {
    Client.Login("My_Username", "My_Password", AuthMethod.Login);
}
catch(InvalidCredentialsException) {
    Console.WriteLine("The server rejected the supplied credentials");
}

Client.Dispose();

Exceptions

ExceptionCondition
S22.Pop3..::..InvalidCredentialsExceptionThrown if authentication using the supplied credentials failed.

See Also