IImap |
Task NotifyAsync( bool status, IList<ImapEventGroup> eventGroups, CancellationToken cancellationToken = default )
Exception | Condition |
---|---|
ArgumentNullException | eventGroups is null. |
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. |
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.