Skip to main content

CF Email Gateway - A Worker between Email Routing and my inbox

·798 words·4 mins
Reyn Hartono
Author
Reyn Hartono
I build and operate systems that stay reliable and secure under real load. Open to senior roles in backend and SRE/infra, and to technical leadership — remote, globally.

I’m releasing CFEG (Cloudflare Email Gateway): open tooling on Cloudflare Email Routing so you can keep what hits your domain when you want, forward on your terms, and send from the address the sender wrote to — including catch-all privacy locals — without drowning in Gmail Send mail as setup.

Today it is public:

This post is the release note and the short story of why it exists.


Why I built it
#

I run catch-all privacy mail on domains I control. Each service gets its own local-part — netflix@…, github@…, that-one-marketplace@… — so a leak or a spam wave points at one alias, not my whole life.

That only works if two things stay true:

  1. Mail that hits the domain is still mine if the inbox behind the forward is having a bad day.
  2. I can answer as the address the sender wrote to, not as a single shared “real” mailbox.

Cloudflare Email Routing made the first half easy: MX, catch-all, forward into Gmail. The second half looked free until it wasn’t.

Forwarding is not a vault. Destinations go down. Mailboxes fill up. Rate limits bite. If the only copy was “whatever made it through,” a failed forward is a silent loss. I wanted a durable keep of what arrived at my domain when I chose to archive — independent of Gmail’s mood that minute.

Gmail Send mail as does not scale. It is fine for a handful of From addresses. It is not a plan for hundreds of privacy locals. I was not going to add and verify every shop and SaaS alias under Accounts → Send mail as. So the easy path is to reply from the catch-all inbox address, break the sender’s expectation of who they wrote to, or abandon unique locals the first time a real thread matters.

I did not set out to ship an email product. I set out to stop losing mail and stop hitting Reply from the wrong From address. CFEG is what I built for that — and what I am open-sourcing so others on the same path can run it themselves.


What’s in the release
#

CapabilityWhat you get
Archive on receive (optional)Durable copy of inbound MIME when you enable it; survive dest outages, full storage, rate limits
Forward (optional)Still land mail in your inbox — or skip forward for keep-only / quiet sink
Reply tokens / hopSend From the original recipient address without per-alias Send mail as
Compose as any addressNew mail from catch-all / role identities in the same model
CFEG Reply (Gmail)Reply / Reply-All in the UI you already use, routed through the hop

Archive and forward are independent. Run archive + forward, archive only, or forward only — your routing config, your call.


How it fits together
#

Inbound — your policy, not a fixed pipeline
#

Sender
Cloudflare Email Routing
CFEG Worker
  ├─► Archive (optional)
  └─► Forward (optional) ──► Your inbox

When archive is on, the kept copy does not depend on the destination being up, having free storage, or accepting more mail right then.

Outbound — send From the address they wrote to
#

Gmail (CFEG Reply) or send/reply client
CFEG hop (reply / compose token)
Sent with the real From
  (catch-all local-part, role address, …
   — no per-alias Gmail "Send mail as")

I still live in Gmail day to day. The extension makes the hop usable without adding every alias under Send mail as.


Who it’s for
#

  • Domains already on Cloudflare Email Routing that need more than best-effort forward
  • Catch-all privacy setups where unique local-parts are the product, not an edge case
  • Anyone juggling many identities on one domain and tired of Gmail Send mail as as the only way to pick From

If you only need one alias and never care about a receive log, plain Email Routing is enough. CFEG is for when the domain is the identity surface.


Try it
#

  1. Clone and read the install guide in the gateway repo: docs/18-installation.md
  2. Deploy the Worker, point Email Routing catch-all at it, set your routing YAML and secrets
  3. Optional: install CFEG Reply for Gmail Reply / Reply-All

You own the stack — Cloudflare account, R2/D1, SMTP, policy. CFEG is tooling around Email Routing, not a hosted mailbox.


Closing
#

I built CFEG so mail that hits my domains can be kept when I choose, and every address those domains own can appear in From — not only the few I bothered to add under Gmail Send mail as.

If that matches how you run mail, the code is here:

Issues and PRs welcome. Wire it to your own routes, storage, and policy.