Pop 3ClientAuthenticate Async(Sasl Mechanism, Cancellation Token) Method
Asynchronously authenticate using the specified SASL mechanism.
Definition
Namespace: MailKit.Net.Pop3
Assembly: MailKit (in MailKit.dll) Version: 5.0.0
An asynchronous task context.
IMailServiceAuthenticateAsync(SaslMechanism, CancellationToken)
Assembly: MailKit (in MailKit.dll) Version: 5.0.0
C#
public override Task AuthenticateAsync(
SaslMechanism mechanism,
CancellationToken cancellationToken = default
)Parameters
- mechanism SaslMechanism
- The SASL mechanism.
- cancellationToken CancellationToken (Optional)
- The cancellation token.
Return Value
TaskAn asynchronous task context.
Implements
IMailServiceAuthenticateAsync(SaslMechanism, CancellationToken)IMailServiceAuthenticateAsync(SaslMechanism, CancellationToken)
Remarks
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.
Exceptions
| ArgumentNullException | mechanism is . |
| ObjectDisposedException | The Pop3Client has been disposed. |
| ServiceNotConnectedException | The Pop3Client is not connected. |
| InvalidOperationException | The Pop3Client 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. |
| Pop3CommandException | A POP3 command failed. |
| Pop3ProtocolException | An POP3 protocol error occurred. |