Click or drag to resize
MimeKit

ImapClientNotify Method

Request the specified notification events from the IMAP server.

Namespace:  MailKit.Net.Imap
Assembly:  MailKit (in MailKit.dll) Version: 2.10.0
Syntax
C#
public void Notify(
	bool status,
	IList<ImapEventGroup> eventGroups,
	CancellationToken cancellationToken = null
)

Parameters

status
Type: SystemBoolean
true if the server should immediately notify the client of the selected folder's status; otherwise, false.
eventGroups
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.

Implements

IImapClientNotify(Boolean, IListImapEventGroup, CancellationToken)
Exceptions
ExceptionCondition
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.
Remarks

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 Idle(CancellationToken, CancellationToken), can be used to get instant notifications for changes to any of the specified folders.

See Also