Email API for agents: appending RFC 5322 copies to Sent via IMAP to fix missing outbound mail
kumard3 · reddit · 2026-11-11
A developer building an email API for agents found that sends via SES/Resend were stored in Postgres but never written to the mailbox itself, so anyone viewing an agent's inbox in a mail client saw incoming replies but none of the agent's outbound messages.
The fix: every send also builds the same RFC 5322 message with the same Message-ID and appends it to the Sent folder over IMAP, flagged as read. The append runs after the send with errors only logged, so a mail-store problem can't fail a send—at the cost of an occasional missing Sent copy. A rerunnable backfill script handles older mail and skips Message-IDs already in Sent.
More from coding & agent
- FastMCP team takes over GitHub HQ on Dec 2 for MCP skills and auth talks — LangChain · 2026-11-11
- Mintlify open-sources agent-traffic: agents made 489M doc requests, 77% of all traffic — handotdev · 2026-11-11
- Baseten details deep research agent training: breadth-rewarding RL plus SFT for report writing — baseten · 2026-11-11
- Practical Data: Chrome extension applies AI semantic formatting to web tables — calabi_and_yau · 2026-11-11
- Google Antigravity ships 81 weekly updates: Gemini 4 Carbon and /swarm multi-agent land — rseroter · 2026-11-11
- Agent workflow upgrade: narrated demo videos of each change instead of HTML reports — randal_olson · 2026-11-11