operations

Inbound Pipeline

How inbound mail is validated, parsed, sanitized, and persisted.

Processing flow

  1. Cloudflare Email Routing forwards inbound mail to the worker email handler.
  2. Address existence and sender-domain policy checks run first.
  3. MIME is parsed and HTML/text are sanitized.
  4. Metadata is persisted in D1; files are persisted in R2.
  5. Retrieval is guarded by organization scope.

Storage paths

Attachments are stored under:

TextText output example
email-attachments/<organizationId>/<addressId>/<emailId>/<attachmentId>-<filename>