IMail | 
void Authenticate( SaslMechanism mechanism, CancellationToken cancellationToken = default )
| Exception | Condition | 
|---|---|
| ArgumentNullException | mechanism is . | 
| ObjectDisposedException | The MailService has been disposed. | 
| InvalidOperationException | The MailService is not connected or is already authenticated. | 
| OperationCanceledException | The operation was canceled via the cancellation token. | 
| AuthenticationException | Authentication using the supplied credentials has failed. | 
| SaslException | A SASL authentication error occurred. | 
| IOException | An I/O error occurred. | 
| ProtocolException | A protocol error occurred. | 
Authenticates using the specified SASL mechanism.
For a list of available SASL authentication mechanisms supported by the server, check the AuthenticationMechanisms property after the service has been connected.