Skip to main content

Module imap

Module imap 

Source
Expand description

IMAP server implementation

This module implements an IMAP (Internet Message Access Protocol) server that allows LLM control over email retrieval and mailbox management.

Key points:

  • IMAP4rev1 commands parsed by hand into (tag, command, args). There is no imap-codec and no grammar: anything the split does not model (literals, continuations, quoting) is passed to the model as raw text.
  • Session state management (NotAuthenticated -> Authenticated -> Selected -> Logout)
  • Plain TCP only. An ImapServer::spawn_with_tls used to sit here advertising IMAPS on 993; nothing called it and it could not have worked - it fed a concatenated PEM string to Identity::from_pkcs12, which only accepts DER PKCS#12 - so it was removed rather than left as an implemented-looking feature.
  • No mailbox storage: the model answers LIST/FETCH/SEARCH from its instruction and memory.

Modules§

actions
IMAP protocol actions implementation

Structs§

ImapServer
IMAP server that handles mail retrieval with LLM

Constants§

DEFAULT_CAPABILITIES
The capability list NetGet answers CAPABILITY with when the greeting announced none.
MAX_COMMAND_BYTES
Largest single command line the server will buffer before refusing the peer.

Functions§

greeting_capabilities
The capability list a greeting announced in its [CAPABILITY ...] response code, with IMAP4rev1 guaranteed first; None when the greeting carried no such code.
imap_answer_with
Which action answers one IMAP command, or None when the command’s name does not say.
retag_completion
Does this payload contain the tagged OK completion for tag?
with_imap4rev1
list with IMAP4rev1 first and not repeated. RFC 3501 6.1.1: the list MUST include it, and imaplib refuses a server whose list does not.