Click or drag to resize
MimeKit

MailServiceAuthenticateAsync(SaslMechanism, CancellationToken) Method

Asynchronously authenticate using the specified SASL mechanism.

Namespace: MailKit
Assembly: MailKit (in MailKit.dll) Version: 4.7.1
Syntax
C#
public abstract Task AuthenticateAsync(
	SaslMechanism mechanism,
	CancellationToken cancellationToken = default
)

Parameters

mechanism  SaslMechanism
The SASL mechanism.
cancellationToken  CancellationToken  (Optional)
The cancellation token.

Return Value

Task
An asynchronous task context.

Implements

IMailServiceAuthenticateAsync(SaslMechanism, CancellationToken)
Exceptions
ExceptionCondition
ArgumentNullExceptionmechanism is null.
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.
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.

See Also