Class ImapIdleSession
Represents an active IMAP IDLE session (RFC 2177). Created by StartIdle(). The session runs a background thread that reads server-pushed untagged responses and raises events. Callers must marshal event handlers to their own thread. To issue any other command on the ImapClient, call Stop() (or Dispose()) first.
Implements
Inherited Members
Namespace: DRIT.Mail.Rfc.Imap
Assembly: DRIT.Mail.dll
Syntax
public sealed class ImapIdleSession : IDisposable
Properties
View SourceIsActive
Gets a value indicating whether the IDLE session is still running (the background thread is alive and Stop() has not been called).
Declaration
public bool IsActive { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
View SourceDispose()
Stops the session (if still active) and releases resources.
Declaration
public void Dispose()
Stop()
Stops the IDLE session by sending DONE, waiting for the
tagged OK, and joining the background thread. Safe to call
multiple times.
Declaration
public void Stop()
Events
View SourceError
Raised when the transport or protocol encounters an error during IDLE. After this event fires, the session is no longer active.
Declaration
public event EventHandler<ImapIdleErrorEventArgs>? Error
Event Type
| Type | Description |
|---|---|
| EventHandler<ImapIdleErrorEventArgs> |
FlagsChanged
Raised when the server reports a flag change on a message
(* N FETCH (FLAGS (...))).
Declaration
public event EventHandler<ImapFlagsChangedEventArgs>? FlagsChanged
Event Type
| Type | Description |
|---|---|
| EventHandler<ImapFlagsChangedEventArgs> |
MessageArrived
Raised when the server reports a new message count
(* N EXISTS, where the count increased).
Declaration
public event EventHandler<ImapExistsEventArgs>? MessageArrived
Event Type
| Type | Description |
|---|---|
| EventHandler<ImapExistsEventArgs> |
MessageExpunged
Raised when the server reports a message was permanently removed
(* N EXPUNGE).
Declaration
public event EventHandler<ImapExpungeEventArgs>? MessageExpunged
Event Type
| Type | Description |
|---|---|
| EventHandler<ImapExpungeEventArgs> |
RecentChanged
Raised when the server reports a new recent-message count
(* N RECENT).
Declaration
public event EventHandler<ImapRecentEventArgs>? RecentChanged
Event Type
| Type | Description |
|---|---|
| EventHandler<ImapRecentEventArgs> |