Initializes a new instance of the Pop3Client class and connects to the specified port on the specified host, optionally using the Secure Socket Layer (SSL) security protocol.

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

Syntax

C#
public Pop3Client(
	string hostname,
	int port = 110,
	bool ssl = false,
	RemoteCertificateValidationCallback validate = null
)

Parameters

hostname
Type: System..::..String
The DNS name of the server to which you intend to connect.
port (Optional)
Type: System..::..Int32
The port number of the server to which you intend to connect.
ssl (Optional)
Type: System..::..Boolean
Set to true to use the Secure Socket Layer (SSL) security protocol.
validate (Optional)
Type: System.Net.Security..::..RemoteCertificateValidationCallback
Delegate used for verifying the remote Secure Sockets Layer (SSL) certificate which is used for authentication. Set this to null if not needed

Examples

This example shows how to establish a connection with a POP3 server and print out the POP3 options, which the server supports.
CopyC#
/* Connect to AOL's POP3 server */
Pop3Client Client = new Pop3Client("pop.aol.com");

/* Print out the server's capabilities. */
foreach(string s in Client.Capabilities())
    Console.WriteLine(s);

Client.Dispose();

Exceptions

ExceptionCondition
System..::..ArgumentOutOfRangeExceptionThe port parameter is not between MinPort and MaxPort.
System..::..ArgumentNullExceptionThe hostname parameter is null.
System.Net.Sockets..::..SocketExceptionAn error occurred while accessing the socket used for establishing the connection to the POP3 server. Use the ErrorCode property to obtain the specific error code
System.Security.Authentication..::..AuthenticationExceptionAn authentication error occured while trying to establish a secure connection.
S22.Pop3..::..BadServerResponseExceptionThrown if an unexpected response is received from the server upon connecting.

See Also