Skip to content

Answers by email come back into the conversation (ADR-0029 step 2) - #222

Draft
yatping wants to merge 3 commits into
feat/reply-emailsfrom
feat/email-answers
Draft

yatping wants to merge 3 commits into
feat/reply-emailsfrom
feat/email-answers

Conversation

@yatping

@yatping yatping commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Step 2 of ADR-0029, stacked on #221.

What it does

A visitor can answer a reply email from their mail app, and the answer appears in the same conversation as their message, marked Sent by email.

  • Each reply email's Reply-To is an address of its own, reply+<token>@…. Only the token's hash is stored (conversation_reply_addresses, migration 0045, a new table only).
  • The Worker's email handler refuses unknown addresses, drops automatic email, refuses over 10 MiB and over 30 an hour for a token, then stores the email in R2 and queues email.inbound.
  • The job reads it with postal-mime (new dependency, MIT-0, approved by the ADR), cuts what the mail app quoted, keeps up to five attachments of the widget's kinds, and writes the message once however often the email or job arrives.
  • The inbox shows the sender's address when it is not the contact's, and how many attachments were not kept. 11 languages.
  • oc deploy --reply-email <address> adds one Email Routing rule and an R2 lifecycle rule. Subaddressing is a step by hand in the Cloudflare dashboard.
  • Without a reply address, reply emails still go out and say answers are not read.

Where it differs from the ADR as accepted

Marked "As built" in the ADR: one token for each email, not one for each conversation; wrangler email routing rules create and not the addresses field, which would reset a domain's other rules; refused attachments are counted, not written as a line of text. OpenChat Cloud receives on the apex, by the owner's choice.

Checked

  • pnpm verify parts: lint, typecheck, 1,394 API tests (26 new), build, contracts, migrations, licences, budget, secrets, channel.
  • Real Cloudflare, recorded in cloudflare-validation.md: the three points the ADR left open, then the feature end to end on a throwaway installation.
  • Not checked: an answer written in a real mail app to the delivered email; a subdomain. Playwright: 108 passed.

🤖 Generated with Claude Code

yatping and others added 3 commits December 4, 2026 22:33
One domain sends and receives, a code after a plus reaches its rule once
subaddressing is on, and email failing a reject policy never reaches the Worker.
Cloud receives at reply@openchat.run, by the owner's choice.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Patrick Ng <yatping0617@gmail.com>
A reply email's Reply-To is an address of its own, reply+<token>@, of which only
a hash is kept. The Worker's email handler refuses unknown addresses, drops
automatic email, stores the rest in R2 and queues email.inbound. The job reads it
with postal-mime, cuts what the mail app quoted, keeps the attachments the widget
would take, and writes the visitor's message once, however often the email or
the job arrives. The inbox marks it as sent by email, with the sender's address
when it is not the contact's. oc deploy --reply-email sets it up.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Patrick Ng <yatping0617@gmail.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Patrick Ng <yatping0617@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant