reusser/craft-cloudflare-email 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

reusser/craft-cloudflare-email

最新稳定版本:v1.0.0

Composer 安装命令:

composer require reusser/craft-cloudflare-email

包简介

Cloudflare Email Sending integration for Craft CMS

README 文档

README

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

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 10
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固