Click or drag to resize

ImapClientNotifyAsync Method

Asynchronously request the specified notification events from the IMAP server.

Namespace:  MailKit.Net.Imap
Assembly:  MailKit (in MailKit.dll) Version: 2.10.0
public Task NotifyAsync(
	bool status,
	IList<ImapEventGroup> eventGroups,
	CancellationToken cancellationToken = null


Type: SystemBoolean
true if the server should immediately notify the client of the selected folder's status; otherwise, false.
Type: System.Collections.GenericIListImapEventGroup
The specific event groups that the client would like to receive notifications for.
cancellationToken (Optional)
Type: System.ThreadingCancellationToken
The cancellation token.

Return Value

Type: Task
An asynchronous task context.


IImapClientNotifyAsync(Boolean, IListImapEventGroup, CancellationToken)
ArgumentNullExceptioneventGroups is null.
ArgumentExceptioneventGroups is empty.
ObjectDisposedException The ImapClient has been disposed.
ServiceNotConnectedException The ImapClient is not connected.
ServiceNotAuthenticatedException The ImapClient is not authenticated.
InvalidOperationException One or more ImapEventGroup is invalid.
NotSupportedException The IMAP server does not support the NOTIFY extension.
OperationCanceledException The operation was canceled via the cancellation token.
IOException An I/O error occurred.
ImapCommandException The server replied to the NOTIFY command with a NO or BAD response.
ImapProtocolException The server responded with an unexpected token.

The NOTIFY command is used to expand which notifications the client wishes to be notified about, including status notifications about folders other than the currently selected folder. It can also be used to automatically FETCH information about new messages that have arrived in the currently selected folder.

This, combined with IdleAsync(CancellationToken, CancellationToken), can be used to get instant notifications for changes to any of the specified folders.

See Also