Skip to content

Cloudflare Email Relay

A multi-tenant Cloudflare Email Routing Worker that stores every inbound message and pushes it to the right Odoo or Frappe instance with durable retries.

GeneralActiveMIT
View on GitHub (opens in a new tab)
Platform

General

License
MIT
Status
Active
Part of

Cloudflare Email

The Cloudflare Email Relay is the inbound half of Avunu's Cloudflare Email suite. Cloudflare Email Routing hands each message to this Worker, which stores it and pushes it to the ERP that owns the recipient's domain: an Odoo database running mail_cloudflare or a Frappe site running cloudflare_email_delivery. An ERP outage, a wrong secret, or a bad deploy can delay a message, but it can't lose one. It's for teams running several ERP instances on Cloudflare-hosted domains who want to drop IMAP mailboxes entirely.

Features

  • Store first. Each message is written to R2 before anything else happens. If storage fails, Cloudflare tells the sending server to retry.

  • Durable delivery. One SQLite-backed Durable Object per tenant delivers messages oldest first, with back-off and retention you can tune.

  • Signed pushes. Every attempt is an HTTPS POST of the raw message, signed with HMAC-SHA256 and timestamped. Optional Cloudflare Access service tokens are supported.

  • Multi-tenant. One Worker serves many ERP instances, routed by recipient domain, including wildcard subdomains. Unknown or disabled domains are rejected at SMTP time.

  • Ops API per tenant, behind a bearer token, to list, inspect, retry, and delete deliveries.

  • Library, not app. Deployments are thin wrappers with a tenant table, and the same validation schemas run in CI.

Getting started

The relay is published as an npm package. A deployment is a few lines of wrapper code, a tenants.json, and a wrangler.jsonc, and it needs the Workers Paid plan. The README documents the tenant model, the inbound contract, and deployment. Pair it with the Frappe or Odoo adapter.

Related projects

All open-source projects

Odoo 18 modules that send and receive email through Cloudflare and run two-way Twilio SMS and MMS conversations inside Discuss.

AGPL-3.0-or-laterGitHub

Routes all WordPress email through the Cloudflare Email Sending API and keeps a searchable log of every message, with no settings screen.

Need help with it?

Need this implemented? We run the relay for clients as part of managed infrastructure.