IMail |
Task ConnectAsync( string host, int port, bool useSsl, CancellationToken cancellationToken = default )
Exception | Condition |
---|---|
ArgumentNullException | The host is null. |
ArgumentOutOfRangeException | port is not between 0 and 65535. |
ArgumentException | The host is a zero-length string. |
ObjectDisposedException | The IMailService has been disposed. |
InvalidOperationException | The IMailService is already connected. |
OperationCanceledException | The operation was canceled via the cancellation token. |
IOException | An I/O error occurred. |
ProtocolException | A protocol error occurred. |
Asynchronously establishes a connection to the specified mail server.
If a successful connection is made, the AuthenticationMechanisms property will be populated.