Pop3Client.Connect(String, Int32, Boolean, Int32, Int32, RemoteCertificateValidationCallback) Method

OpenPop.NET

OpenPop.NET POP3 Library Documentation

Pop3Client.Connect(String, Int32, Boolean, Int32, Int32, RemoteCertificateValidationCallback) Method

Connects to a remote POP3 server

public void Connect(
   string hostname,
   int port,
   bool useSsl,
   int receiveTimeout,
   int sendTimeout,
   RemoteCertificateValidationCallback certificateValidator
);

Parameters

hostname
The hostname of the POP3 server
port
The port of the POP3 server
useSsl
true if SSL should be used. false if plain TCP should be used.
receiveTimeout
Timeout in milliseconds before a socket should time out from reading. Set to 0 or -1 to specify infinite timeout.
sendTimeout
Timeout in milliseconds before a socket should time out from sending. Set to 0 or -1 to specify infinite timeout.
certificateValidator
If you want to validate the certificate in a SSL connection, pass a reference to your validator. Supply a null reference if default should be used.

Exceptions

Exception Type Condition
PopServerNotAvailableException If the server did not send an OK message when a connection was established
PopServerNotFoundException If it was not possible to connect to the server
ArgumentNullException If hostname is a null reference
ArgumentOutOfRangeException If port is not in the range [MinPort, MaxPort or if any of the timeouts is less than -1.

See Also

Pop3Client Class | OpenPop.Pop3 Namespace | Pop3Client.Connect Overload List