Click or drag to resize
MimeKit

ImapClientCompressAsync Method

Asynchronously enable compression over the IMAP connection.

Namespace:  MailKit.Net.Imap
Assembly:  MailKit (in MailKit.dll) Version: 2.14.0
Syntax
C#
public Task CompressAsync(
	CancellationToken cancellationToken = default
)

Parameters

cancellationToken (Optional)
Type: System.ThreadingCancellationToken
The cancellation token.

Return Value

Type: Task
An asynchronous task context.

Implements

IImapClientCompressAsync(CancellationToken)
Exceptions
ExceptionCondition
ObjectDisposedException The ImapClient has been disposed.
ServiceNotConnectedException The ImapClient is not connected.
InvalidOperationException Compression must be enabled before a folder has been selected.
NotSupportedException The IMAP server does not support the COMPRESS extension.
OperationCanceledException The operation was canceled via the cancellation token.
IOException An I/O error occurred.
ImapCommandException The server replied to the COMPRESS command with a NO or BAD response.
ImapProtocolException An IMAP protocol error occurred.
Remarks

Asynchronously enables compression over the IMAP connection.

If the IMAP server supports the Compress extension, it is possible at any point after connecting to enable compression to reduce network bandwidth usage. Ideally, this method should be called before authenticating.

See Also