定制 sohaibilyas/laravel-cloudflare-email 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

sohaibilyas/laravel-cloudflare-email

Composer 安装命令:

composer require sohaibilyas/laravel-cloudflare-email

包简介

A Cloudflare Email Service mail transport for Laravel.

README 文档

README

A Laravel mail transport for sending transactional mail through Cloudflare Email Service.

Installation

composer require sohaibilyas/laravel-cloudflare-email

Configuration

Enable Email Sending for your domain in Cloudflare, then add your account ID and API token to .env:

CLOUDFLARE_ACCOUNT_ID=your-account-id
CLOUDFLARE_EMAIL_TOKEN=your-api-token

You may also pass the full authorization header value:

CLOUDFLARE_EMAIL_TOKEN="Bearer your-api-token"

The package automatically registers a cloudflare-email Laravel mailer. Set it as your default mailer:

MAIL_MAILER=cloudflare-email
MAIL_FROM_ADDRESS=noreply@example.com
MAIL_FROM_NAME="${APP_NAME}"

Laravel 13 includes its own native cloudflare mail transport. This package intentionally uses cloudflare-email so it does not collide with Laravel's built-in driver. It is most useful for Laravel 11 and 12 projects where Cloudflare Email is not available by default, or for apps that want this package's explicit REST transport behavior.

Publishing the config file is optional. Use it only when you want the Cloudflare Email package config in your app:

php artisan vendor:publish --tag=cloudflare-email-config

If you prefer to configure Cloudflare Email inside Laravel's mail config instead, you may add a cloudflare-email entry to config/mail.php:

'mailers' => [
    'cloudflare-email' => [
        'transport' => 'cloudflare-email',
        'account_id' => env('CLOUDFLARE_ACCOUNT_ID'),
        'token' => env('CLOUDFLARE_EMAIL_TOKEN'),
        'timeout' => env('CLOUDFLARE_EMAIL_TIMEOUT', 30),
    ],
],

Usage

Use Laravel's mail API as usual:

use App\Mail\WelcomeMail;
use Illuminate\Support\Facades\Mail;

Mail::to('info@example.com')->send(new WelcomeMail);

The transport sends requests to:

https://api.cloudflare.com/client/v4/accounts/{account_id}/email/sending/send

Cloudflare Email Service requires the MAIL_FROM_ADDRESS domain to be enabled for Email Sending in your Cloudflare account.

Testing

composer test

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固