↵select↑↓navigateescclose
Search Cloudflare Email Delivery

Cloudflare Email Delivery

Send and receive Frappe email through Cloudflare, with no SMTP or IMAP server to run or poll.

Updated
On this page

Running email for a Frappe or ERPNext site usually means SMTP credentials for sending, an IMAP mailbox the scheduler polls for receiving, and a mail provider in between. Cloudflare Email Delivery replaces both for sites whose domains are on Cloudflare. Outgoing mail goes straight from Frappe to the Cloudflare Email Sending API. Incoming mail is pushed to the site by the Cloudflare email relay, a Cloudflare Worker, over a signed HTTPS webhook, and Frappe processes it the way it processes mail it pulls from a mailbox: Append To, auto-replies, attachments, notifications and reply threading work as before.

It is for administrators of Frappe sites who already manage their domains on Cloudflare and want one place for mail. It runs on Frappe v16 and is free software under the MIT licence.

What you get

Sending without SMTP

An Email Domain with Send via Cloudflare holds a Cloudflare account ID and API token instead of SMTP settings, and saving it checks the token. Every Email Account on that domain then sends through the Cloudflare API, with attachments, inline images and the threading headers. See Send mail through Cloudflare.

An Email Domain set to Send via Cloudflare, with the Cloudflare account ID and API token in place of SMTP settings

Receiving without IMAP polling

An incoming Email Account on that domain gets a Webhook URL and a Webhook Secret when you save it. The relay posts every message to the URL, the app checks its signature and recipient domain, and the message becomes a Communication on the account's Append To document. See Receive mail from the relay.

An Email Account on a Cloudflare domain: its Incoming tab shows the Webhook URL, key and secret for the relay, and the Cloudflare Webhook buttons

Replies that land on the right document

Cloudflare replaces the Message-ID of every message it sends, which would normally break Frappe's reply matching. The app keeps Frappe's own id in References and matches replies on it, so a customer's answer lands in the timeline of the document it belongs to. See Reply threading.

A ToDo created from a customer's e-mail, with the reply sent from the desk and the customer's answer threaded in its timeline

A documented webhook

The webhook answers each delivery with a status code that tells the relay whether to retry, park or accept the message, and processes mail as a disabled, least-privilege user instead of Administrator. See The webhook contract.

Where to start

You areRead
A desk user sending and answering emailReply threading
The administrator setting it upInstall and upgrade, Configuration, Send mail through Cloudflare and Receive mail from the relay
The administrator when something goes wrongLimitations and troubleshooting
Whoever runs the relay, or writes another senderThe webhook contract
A developer changing the appDevelopment and How it works

Requirements

  • A bench with Frappe v16. The app declares frappe >=16.0.0,<17.0.0 and Python 3.14 or newer. It needs no other Frappe app.

  • A Cloudflare account on the Workers Paid plan, with the domain onboarded for Email Sending and Email Routing enabled on its zone.

  • A Cloudflare API token with the Email Sending: Edit permission, account-owned or personal.

  • For incoming mail: the site reachable over HTTPS with host_name set in its site config, and a deployment of the Cloudflare email relay with a tenant entry for the site.

These pages describe the code in the repository. Where a statement depends on Frappe's own behaviour, the page says so; it was checked against Frappe 16.52.

Source and changes

The source is at github.com/Avunu/cloudflare_email_delivery. Release notes are on the GitHub releases page, and release-please writes them to CHANGELOG.md with the first release.

The app is one part of Avunu's Cloudflare Email suite, beside the relay, the Odoo module mail_cloudflare and the WordPress plugin.