Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cf-mail data plane

The self-hosted data plane for Cloudflare Mail — an ingest Worker + D1 that receives your domain's mail, stores it, and sends replies, all in your own Cloudflare account. The adaptive inbox app (hosted) reads it over a tokened HTTP API. Your mail never leaves your account.

1. Deploy to your account

Deploy to Cloudflare

This provisions a D1 database + the ingest Worker and gives you a Worker URL like https://cf-mail-ingest.<you>.workers.dev. The Worker creates its own tables on first request — no migration step.

2. Set the API token

Generate a strong random token, set it as a secret, and keep a copy — you'll paste it into Connect:

openssl rand -hex 32          # copy this
npx wrangler secret put MAIL_API_TOKEN   # paste it

Optional, to let the inbox admin panel auto-create per-user routing rules:

# Token scopes: Zone → Zone (Read) + Zone → Email Routing Rules (Edit)
npx wrangler secret put CF_API_TOKEN

3. Enable email for your domain

  • Email Routing (receiving): enable it, then route each address to this Worker (npx wrangler email routing enable yourdomain.com). The inbox admin panel creates per-address rules for you once CF_API_TOKEN is set.
  • Email Sending (replies): onboard your domain (Cloudflare dashboard → Email Service → Email Sending, or wrangler email sending enable yourdomain.com).

4. Connect

Go to the hosted app's “Set up your Cloudflare domain” page and enter:

  • your domain,
  • the Worker URL from step 1,
  • the MAIL_API_TOKEN from step 2,
  • your admin username.

You'll get a one-time setup link to activate your admin inbox. Done.

What runs here

src/index.tsemail() ingest handler + a tokened HTTP API (threads, send, auth, admin, control). src/schema.ts — self-migrating D1 schema. This is a snapshot of the worker/ directory in the main app repo.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages