LC-77-DEAD-LETTER: optional dead-letter IMAP folder for poison messages #203
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Background
LC-77 v1's poll loop marks every processed UID
\Seenafter one attempt, success or fail. A malformed message that drops on parse, resolve, or post stays in the polled mailbox (lets-chat doesn't delete polled mail; it only marks Seen). The operator's only diagnostic is the structuredtarget=email_ingress::droplog line with thereason+detail+from+message_idfields.Some operators may want a recoverable trail: a copy of the malformed message in a separate folder, where they can inspect what was rejected (sender, headers, body) without grepping logs.
When to act
If operators ask for recoverable rejected mail, OR if the structured log proves insufficient for diagnosing real-world drop cases.
Scope
Add an optional dead-letter IMAP folder that the poll loop COPIES failed messages into before marking the source UID
\Seen.imap_inbox_config.dead_letter_folder(e.g."INBOX/lets-chat-rejected").\Seen-after-attempt only).ProcessOutcome::Dropped, before marking\Seen, issueUID COPY <uid> <dead-letter-folder>. If the COPY fails (folder doesn't exist, IMAP server doesn't support it), log INFO and proceed; don't gate the\Seenmark on it.Anti-scope
DropReasongo to the dead-letter folder.Test requirements
References
docs/email-ingress.md"Not supported" section names this asLC-77-DEAD-LETTER.\Seenover dead-letter for v1: "Lean (a) for v1: mark \Seen on every attempt, log failures structured with Message-ID + reason + sender, document that operators can configure their MTA to also Cc a dead-letter mailbox if they want recoverability."