Cloudflare Email for Craft CMS icon

Cloudflare Email for Craft CMS

This plugin provides a Cloudflare Email Sending integration for Craft CMS.

Requirements

  • Craft CMS 4.0.0+ or 5.0.0+
  • PHP 8.0.2+ (Craft 4) or PHP 8.2+ (Craft 5)
  • A Cloudflare account with Email Sending enabled on a verified domain

Installation

From the Plugin Store

Go to the Plugin Store in your project’s Control Panel and search for “Cloudflare Email”. Then click on the “Install” button in its modal window.

With Composer

cd /path/to/my-project.test
composer require reusser/cloudflare-email
./craft plugin/install cloudflare-email

Prerequisites

Before installing this plugin, onboard your sending domain in Cloudflare following Cloudflare's official guide:

➡️ Get started with Cloudflare Email Sending

That walks you through enabling Email Sending on a domain, adding the required SPF/DKIM/DMARC records, and finding your Account ID and API token.

Setup

  1. Create a Cloudflare API token with the Email Sending permission scoped to your account. You can do this from your Cloudflare dashboard under My Profile → API Tokens → Create Token → Custom token.
  2. In Craft, go to Settings → Email.
  3. Set the Transport Type to Cloudflare Email.
  4. Enter your Account ID and API Token.
  5. Save and send a test email.

Environment variables (recommended)

Both fields support environment variables. Add the following to your .env file:

CLOUDFLARE_ACCOUNT_ID="your-account-id"
CLOUDFLARE_API_TOKEN="your-api-token"

Then enter $CLOUDFLARE_ACCOUNT_ID and $CLOUDFLARE_API_TOKEN in the corresponding settings fields.

See Environmental Configuration in the Craft docs for more on environment variables.

How it works

Mail is sent via Cloudflare’s API:

POST https://api.cloudflare.com/client/v4/accounts/{account_id}/email/sending/send
Authorization: Bearer {token}
Accept: application/json

The transport translates Symfony’s Email object into Cloudflare’s expected JSON payload, including support for:

  • from, to, cc, bcc, reply_to
  • HTML and plain-text bodies
  • Custom headers
  • Attachments (base64-encoded)

Errors returned by Cloudflare are surfaced as Symfony TransportExceptions.

Troubleshooting

  • invalid_request_schema errors — the most common cause is an unverified sender domain or an address that isn’t allowed by your Cloudflare Email Sending configuration.
  • 401 Unauthorized — verify the API token has the Email Sending permission and is scoped to the correct account.
  • No emails arriving — check Cloudflare’s Email Sending dashboard for delivery and bounce status.

Development

composer test         # run Pest tests
composer phpstan      # static analysis
composer format       # apply Pint formatting
composer check-format # CI-friendly format check

License

MIT

Installation Instructions

To install this plugin, copy the command above to your terminal.

Reviews

This plugin doesn't have any reviews.

Active Installs
0
Version
v1.0.0
License
MIT
Compatibility
Craft 4, Craft 5
Last release
May 14, 2026
Categories
Activity (30 days)
0
Closed Issues
0
Open Issues
0
Merged PRs
0
Open PRs