IMail ServiceDisconnect Async Method
Asynchronously disconnect the service.
Definition
Namespace: MailKit
Assembly: MailKit (in MailKit.dll) Version: 5.0.0
An asynchronous task context.
Assembly: MailKit (in MailKit.dll) Version: 5.0.0
C#
Task DisconnectAsync(
bool quit,
CancellationToken cancellationToken = default
)Parameters
- quit Boolean
- If set to , a logout/quit command will be issued in order to disconnect cleanly.
- cancellationToken CancellationToken (Optional)
- The cancellation token.
Return Value
TaskAn asynchronous task context.
Remarks
Asynchronously disconnects from the service.
If quit is , a "QUIT" command will be issued in order to disconnect cleanly.
Exceptions
| ObjectDisposedException | The IMailService has been disposed. |
| ServiceNotConnectedException | The IMailService is not 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. |