Expand description
IMAP protocol implementation for RusMES
This crate provides a full-featured, RFC-compliant IMAP server implementation built on Tokio for asynchronous I/O.
§RFC Compliance
- RFC 9051 (IMAP4rev2) / RFC 3501 (IMAP4rev1): Core IMAP protocol
- RFC 7162 (CONDSTORE / QRESYNC): Efficient mailbox synchronization with
MODSEQtracking,CHANGEDSINCE/UNCHANGEDSINCEmodifiers, and VANISHED responses - RFC 6154 (SPECIAL-USE):
\Drafts,\Sent,\Trash,\Junk, etc. - RFC 4315 (UIDPLUS):
APPENDUIDandCOPYUIDresponse codes - RFC 6851 (MOVE):
MOVEcommand andCOPYUIDresponse for moves - RFC 2177 (IDLE): Server-push idle notification
- RFC 2342 (NAMESPACE): Personal, shared, and other-users namespaces
- RFC 2449 (CAPABILITY): Capability advertisement
§Supported Commands
§Not Authenticated State
CAPABILITY— List server capabilitiesNOOP— No-operation (keep-alive)LOGOUT— DisconnectLOGIN user password— Plain-text authenticationAUTHENTICATE mechanism— SASL authentication (PLAIN, LOGIN, CRAM-MD5, SCRAM-SHA-256, XOAUTH2)
§Authenticated State
SELECT mailbox— Open mailbox read-writeEXAMINE mailbox— Open mailbox read-onlyCREATE mailbox— Create new mailbox (with optionalSPECIAL-USEflag)DELETE mailbox— Delete a mailboxRENAME old new— Rename a mailboxSUBSCRIBE mailbox— Subscribe to a mailboxUNSUBSCRIBE mailbox— Unsubscribe from a mailboxLIST reference mailbox— List mailboxes matching a patternLSUB reference mailbox— List subscribed mailboxes matching a patternNAMESPACE— Query server namespacesAPPEND mailbox ...— Append a message to a mailbox
§Selected State
FETCH sequence items— Retrieve message dataSTORE sequence flags— Modify message flagsSEARCH criteria— Search for messagesCOPY sequence mailbox— Copy messages to another mailboxMOVE sequence mailbox— Move messages to another mailboxEXPUNGE— Permanently delete messages with\DeletedflagCLOSE— Implicit expunge and deselectIDLE— Enter server-push idle mode (RFC 2177)UID FETCH/STORE/SEARCH/COPY/MOVE/EXPUNGE— UID-based variants
§Modules
authenticate: SASL multi-step authentication (PLAIN, LOGIN, CRAM-MD5, SCRAM-SHA-256, XOAUTH2)command: IMAP command enumeration and typescondstore: CONDSTORE extension —MODSEQ,CHANGEDSINCE,UNCHANGEDSINCEconfig: Server configuration (ImapConfig)handler: Command dispatcher (HandlerContext,handle_command)handler_auth: LOGIN and LOGOUT handlershandler_mailbox: Mailbox-level command handlershandler_message: Message-level command handlers (FETCH, STORE, etc.)mailbox_watcher: Watches for mailbox changes to support IDLE push notificationsparser: IMAP command-line parser including APPEND literal handlingqresync: QRESYNC extension — UID range sets, vanished responsesresponse: IMAP response formatting (tagged OK/NO/BAD, untagged*)server: Async TCP listener accepting IMAP connectionssession: Per-connection state machine (NotAuthenticated → Authenticated → Selected ↔ Idle → Logout)special_use:SPECIAL-USEmailbox attributes (RFC 6154)
§Security
All random challenge material (CRAM-MD5, SCRAM nonces) is generated via
getrandom for cryptographic-quality entropy. In production deployments,
TLS should be enabled to protect LOGIN/PLAIN credentials in transit.
Re-exports§
pub use authenticate::create_default_sasl_server;pub use authenticate::handle_authenticate;pub use authenticate::handle_authenticate_continue;pub use authenticate::parse_authenticate_args;pub use authenticate::AuthenticateContext;pub use authenticate::AuthenticateState;pub use command::ImapCommand;pub use command::StoreMode;pub use condstore::ChangedSince;pub use condstore::CondStoreError;pub use condstore::CondStoreResponse;pub use condstore::CondStoreState;pub use condstore::CondStoreStatus;pub use condstore::UnchangedSince;pub use config::ImapConfig;pub use handler::handle_command;pub use handler::HandlerContext;pub use mailbox_watcher::MailboxChanges;pub use mailbox_watcher::MailboxWatcher;pub use parser::has_literal;pub use parser::parse_append_command;pub use parser::parse_command;pub use parser::LiteralType;pub use qresync::QResyncError;pub use qresync::QResyncLogic;pub use qresync::QResyncParams;pub use qresync::QResyncState;pub use qresync::SeqMatchData;pub use qresync::UidRange;pub use qresync::UidSet;pub use qresync::VanishedResponse;pub use response::ImapResponse;pub use server::ImapServer;pub use session::ImapSession;pub use session::ImapState;pub use session::MailboxSnapshot;pub use special_use::format_capability_response;pub use special_use::format_list_extended;pub use special_use::parse_create_special_use;pub use special_use::suggest_special_use;pub use special_use::validate_special_use_flags;pub use special_use::SpecialUse;pub use special_use::SpecialUseError;pub use special_use::SpecialUseFlags;pub use special_use::LIST_EXTENDED_CAPABILITY;pub use special_use::SPECIAL_USE_CAPABILITY;
Modules§
- authenticate
- IMAP AUTHENTICATE command implementation with SASL integration
- command
- IMAP command types
- condstore
- IMAP CONDSTORE Extension - RFC 7162
- config
- IMAP server configuration
- handler
- IMAP command handler dispatcher
- handler_
auth - IMAP authentication command handlers (LOGIN, LOGOUT)
- handler_
mailbox - IMAP mailbox command handlers
- handler_
message - IMAP message command handlers
- mailbox_
watcher - Mailbox change detection for IDLE support
- parser
- IMAP command parser
- qresync
- IMAP QRESYNC Extension - RFC 7162
- response
- IMAP response types
- server
- IMAP server implementation
- session
- IMAP session state machine
- special_
use - IMAP SPECIAL-USE extension (RFC 6154)