cloudflare_email
Cloudflare Email lets Drupal send outbound transactional email through the
Cloudflare Email Service REST API — no SMTP relay required, ideal for hosts
that block outbound mail ports.
Many hosting platforms block outbound SMTP (ports 25/587), which stops
Drupal from sending account, password-reset and notification emails. This
module replaces Drupal's mail backend with one that talks to the
Cloudflare Email Service over HTTPS.
Features
- A drop-in mail backend that routes all of Drupal's outgoing mail through
the Cloudflare Email Service REST API. - Sends both plain-text and HTML messages, with a plain-text fallback
generated automatically from HTML mail. - Stores your Cloudflare API token securely with the
Key module — the token
is referenced by ID and never written into exported configuration. - A settings page for your account ID, API token, and default
from-address/name. - A status report (Reports → Status report) health check that
tells you whether the module is configured and active. - A Drush command,
drush cloudflare-email:test, to send a test
message and confirm your setup.
Use this module when your site runs on infrastructure where outbound SMTP is
blocked, when you want REST-based transactional email without standing up an
SMTP relay, or when you already manage your DNS through Cloudflare.
Post-Installation
- Create a Key entity at
/admin/config/system/keys/add(type
Authentication) holding a Cloudflare API token that has the
Email Sending: Send permission. The environment-variable or file
key provider is recommended for production. - Go to Configuration → System → Cloudflare Email
(/admin/config/system/cloudflare-email) and enter your
Cloudflare account ID, select the API token key, and set a default
from-address and name. - Make the plugin Drupal's default mail backend, e.g. in
settings.php:
$config['system.mail']['interface']['default'] = 'cloudflare_email';
(or via Drush / the Mail System module). - Verify with
drush cloudflare-email:test [email protected].
The from-address must be on a sending domain you have verified in the
Cloudflare dashboard, which provisions the required DNS records (MX, SPF, DKIM,
DMARC).
Additional Requirements
- Drupal 10.3+ or 11.
- The Key module, for
storing the API token. - A Cloudflare account on the Workers Paid plan with the Email Service
enabled, a verified sending domain, and an API token with the
Email Sending: Send permission.
Recommended modules/libraries
- Mail System — set
Cloudflare Email as the mail backend per formatter/plugin through the UI
instead of editingsettings.php. - Drush — provides the
cloudflare-email:testcommand.
Similar projects
- SMTP Authentication
Support and Symfony
Mailer send over SMTP, which needs an open outbound mail port and a
relay. This module is HTTPS/REST-only and needs neither. - Provider-specific modules (SendGrid, Mailgun, Postmark, etc.) target their
own APIs. This module is for sites already using Cloudflare, letting DNS,
reputation and authentication stay in one place.
Supporting this Module
Bug reports and patches are welcome in the
issue
queue.
Community Documentation
What this module does not do (yet)
- Attachments are not yet supported.
- Inbound mail / Email Routing is out of scope; this is sending-only.
- Bounce and complaint webhooks are not yet processed.