Mail |
public abstract Task ConnectAsync( Socket socket, string host, int port = 0, SecureSocketOptions options = SecureSocketOptions.Auto, CancellationToken cancellationToken = default )
| Exception | Condition |
|---|---|
| ArgumentNullException | socket is . -or- host is . |
| ArgumentOutOfRangeException | port is not between 0 and 65535. |
| ArgumentException | socket is not connected. -or- The host is a zero-length string. |
| InvalidOperationException | The IMailService is already connected. |
| OperationCanceledException | The operation was canceled via the cancellation token. |
| IOException | An I/O error occurred. |
| CommandException | The command was rejected by the mail server. |
| ProtocolException | The server responded with an unexpected token. |
Asynchronously establishes a connection to the specified mail server using the provided socket.
If a successful connection is made, the AuthenticationMechanisms property will be populated.