@bijectionhq/app-imap to read one mailbox using IMAP over implicit
TLS. The installer binds the label for the mailbox. The example uses a
dedicated mailbox for content suitable for public disclosure.
Mount and start
bijection/app.ts
mail.operator and call mail.source.initialize with
{ profile: { mode: "imap" } }. Read messages with mail.messages.list and
the source with mail.source.health.
Set the credential with bijection secret set login as
JSON with username, password and mailbox strings. The server must
accept IMAP LOGIN inside TLS. The receiver requires socket egress.
After installation, the app polls once a minute when caught up. The
installer can inspect source.progress and source.health and request
source.poll, source.pause, or source.resume with the current revision.
messages.list returns pages of up to 100 rows; pass the page’s next as
cursor to continue. messages.attachments takes a message key and returns its Files.
The example uses label.public. For protected data, declare a label with
label() and pass it to imapMailbox and as the app’s data. The installation charges retained work and Files against the app’s data label’s
reservation. See installer-bound labels.
Position and limits
The position combines the resolved mailbox scope, UIDVALIDITY and a bounded UID discovery progress. IMAP LOGIN and EXAMINE select the mailbox read-only. Each exchange searches at most 128 UID numbers and reads a 36 KiBBODY.PEEK range. Every range must match the mailbox scope, UIDVALIDITY,
UID, total size and requested offset. IMAP keeps the body immutable for that
identity.
A capture can stage up to 8 MiB of raw MIME for 30 minutes. The final range
commits the raw File, message record, kept attachment Files and completed
UID together. The raw File and up to 32 decoded attachment Files share an
8 MiB publication budget. Attachments beyond the parser or File budget
remain in the raw File. A MIME parse error keeps the raw File and records
the failure. A raw message over 8 MiB blocks the capture progress.
When the mailbox supports persistent MODSEQ, the app reconciles flags in
32-UID windows. QRESYNC uses CHANGEDSINCE VANISHED. CONDSTORE uses
CHANGEDSINCE for flags and bounded UID SEARCH for expunges. The app advances
its exact decimal MODSEQ checkpoint only after the whole recorded window
has been reconciled. Expunges mark previously captured records and retain
their Files. Mail expunged before discovery may never be captured.
Servers with neither extension, and mailboxes reporting NOMODSEQ, use
UID-only capture. Those sources retain no flag or expunge state. A UID that
vanishes between discovery and fetch stops UID-only capture. A changed
mailbox scope or UIDVALIDITY, a changed reconciliation capability, or a
regressed provider position also stops advancement. Inspect source.health
and use source.reset with the current revision and gap stamp to begin a new
baseline. Earlier captures remain readable under their original keys.