IImap ClientNotify Async Method
Asynchronously request the specified notification events from the IMAP server.
Definition
Namespace: MailKit.Net.Imap
Assembly: MailKit (in MailKit.dll) Version: 5.0.0
An asynchronous task context.
Assembly: MailKit (in MailKit.dll) Version: 5.0.0
C#
Task NotifyAsync(
bool status,
IList<ImapEventGroup> eventGroups,
CancellationToken cancellationToken = default
)Parameters
- status Boolean
- if the server should immediately notify the client of the selected folder's status; otherwise, .
- eventGroups IListImapEventGroup
- The specific event groups that the client would like to receive notifications for.
- cancellationToken CancellationToken (Optional)
- The cancellation token.
Return Value
TaskAn asynchronous task context.
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 IdleAsync(CancellationToken, CancellationToken), can be used to get instant notifications for changes to any of the specified folders.
Exceptions
| ArgumentNullException | eventGroups is . |
| ArgumentException | eventGroups 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. |