Namespace DRIT.Mail.Rfc.Imap
Classes
ImapAuthenticationException
Thrown when IMAP authentication fails (e.g. a NO response to
LOGIN or AUTHENTICATE), when no authentication mechanism
can be negotiated, or when authentication is refused over an
unencrypted connection.
ImapClient
Receives and manages mail via IMAP4rev1/IMAP4rev2 (RFC 9051). One instance maintains a single connection. Not thread-safe; use one instance per thread. IDLE runs on a background thread and must not be combined with other commands on the same instance.
ImapClientOptions
Configuration for ImapClient. Mutable during construction; set all properties before calling Connect().
ImapException
The base exception type for all IMAP errors.
ImapExistsEventArgs
Event data for the MessageArrived event,
raised when the server pushes * N EXISTS indicating the
mailbox message count has increased.
ImapExpungeEventArgs
Event data for the MessageExpunged event,
raised when the server pushes * N EXPUNGE indicating a message
was permanently removed.
ImapFlagsChangedEventArgs
Event data for the FlagsChanged event,
raised when the server pushes * N FETCH (FLAGS (...)) during
IDLE, indicating that a message's flags have changed.
ImapFolder
Information about a single IMAP mailbox/folder as returned by LIST or LSUB (RFC 9051 §6.3.8–§6.3.9). Immutable.
ImapIdleActiveException
Thrown when a command is issued on an ImapClient while
an IDLE session is active. The caller must Stop the
IDLE session before issuing other commands.
ImapIdleErrorEventArgs
Event data for the Error event, raised when the transport or protocol encounters an error during IDLE.
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.
ImapMailbox
The result of a SELECT or EXAMINE command (RFC 9051 §6.3.1). Immutable. Contains the mailbox metadata from untagged responses.
ImapMailboxNotSelectedException
Thrown when a command that requires a selected mailbox (FETCH, STORE, SEARCH, COPY, EXPUNGE) is issued while no mailbox is selected.
ImapMailboxStatus
The result of an IMAP STATUS command (RFC 9051 §6.3.10). Immutable. Contains mailbox counts without selecting the mailbox.
ImapMessageInfo
Information about a single message in an IMAP mailbox, as returned by FETCH (RFC 9051 §6.4.5). Immutable. Only the fields requested in ImapFetchOptions are populated; others are null/zero.
ImapMessageSet
Represents a set of IMAP messages addressed by sequence number or
UID (RFC 9051 §9). Produces the compact command-string form with
range collapsing (e.g. 1,2,3 → 1:3).
ImapProtocolException
Thrown when the IMAP server returns a NO or BAD
response, or a malformed reply, or when a required extension is not
advertised.
ImapRecentEventArgs
Event data for the RecentChanged event,
raised when the server pushes * N RECENT.
ImapSearchCriteria
A fluent builder for IMAP SEARCH criteria (RFC 9051 §6.4.4).
Produces the SEARCH argument string (e.g.
FROM "alice" SINCE 1-Jan-2026 UNSEEN). Multiple criteria
chained on the same instance are implicitly ANDed (the IMAP default).
Use Or(ImapSearchCriteria, ImapSearchCriteria) / Not(ImapSearchCriteria) for explicit boolean logic.
ImapServerCapabilities
Extensions advertised by the IMAP server in its CAPABILITY response (RFC 9051 §6.1.1). Immutable.
ImapTimeoutException
Thrown when a read or write operation times out before the IMAP server responds.
Enums
ImapFetchOptions
Specifies which data items to fetch in an IMAP FETCH command (RFC 9051 §6.4.5). Multiple values can be combined with bitwise OR.
ImapFlagOperation
Specifies how STORE modifies message flags (RFC 9051 §6.4.6).
ImapFolderFlags
Flags for an IMAP mailbox/folder as returned by LIST (RFC 9051 §7.3.1). Multiple values can be combined with bitwise OR.
ImapMessageFlags
IMAP system message flags (RFC 9051 §2.3.2). These are the standard flags that servers persist across sessions. User-defined keywords are passed as strings, not via this enum.
ImapSslMode
Specifies the TLS mode for an IMAP connection.
ImapStatusItems
Specifies which status items to request in an IMAP STATUS command (RFC 9051 §6.3.10). Multiple values can be combined with bitwise OR.