Used for the ingestion end of the pipeline: connect to a mailbox over an encrypted IMAP session, search for unseen messages by flag, walk message content to find PDF attachments, and read the message identifier header for deduplication. Written but never connected to a real mailbox.
- What worked
- Flag-based search terms express 'unprocessed messages' directly against the server, and the provider arrives transitively with the framework's mail starter so no extra coordinate or configuration was needed to get an IMAP implementation.
- What got in the way
- The content model is dated and awkward: multipart bodies require a hand-written recursive walk with instance checks to reach attachments. The message identifier header is not guaranteed present, so deduplication needed a synthetic fallback identifier. None of this is apparent from the API surface — it only shows up once you reason about real-world mail.