CloudflareEmail Routing, Workers, and R2

Give your agent its own inbox.

An email address on your domain that saves every email to R2. Your scripts read it with a key that can’t do anything else.

  • No public URLOnly Email Routing can run the Worker
  • Read-only keyScoped to one bucket
  • About 15 minutesOne setup script
  • Free plansEmail Routing, Workers, R2
How it works

Mail in, files out

Read how it works
Path of an email

Private by default

workers_devfalse
fetch handlernone
read key1 bucket, read only

Nobody can call the Worker, and a leaked key can only read mail.

Only the mail you expect

@substack.com[email protected]anyone elsedmarc=pass

Allow listed senders and require DMARC. Everything else bounces.

Plain files you own

r2-mailbox/mail/
2026-11-17/
06:58:12Z-1b9d….eml
07:14:40Z-7c2e….eml

One .eml per email. Open it with the reader, any S3 tool, or any email app.

For scripts and agents

One command to JSON

  • Text pulled out of HTML emails
  • Every link, with the text it was attached to
  • The DMARC result, so you can skip fakes
Send mail to an agent
python3 reader/mailbox.py export --hours 24 -o mail.json
{
  "count": 1,
  "messages": [{
    "from": "Dev Weekly <[email protected]>",
    "subject": "Issue 212: queues, caches, and you",
    "dmarc": "pass",
    "links": [{ "url": "https://…", "text": "Read online" }],
    "text": "This week: three ways to …"
  }]
}

Set up in about 15 minutes.

Clone, run one script, route an address, and create a read-only key.