Download the PHP package julienramel/cloudflare-mailer without Composer
On this page you can find all versions of the php package julienramel/cloudflare-mailer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download julienramel/cloudflare-mailer
More information about julienramel/cloudflare-mailer
Files in julienramel/cloudflare-mailer
Package cloudflare-mailer
Short Description Symfony Mailer bridge for Cloudflare Email Service
License MIT
Homepage https://github.com/julienramel/cloudflare-mailer
Informations about the package cloudflare-mailer
Cloudflare Mailer
Symfony Mailer bridge for Cloudflare Email Service.
Note: Cloudflare Email Sending is currently in public beta. The API may evolve before general availability. Pin your dependency to a specific version of this package.
Requirements
- PHP 8.2+
- Symfony Mailer 6.4+
- A Cloudflare account with Email Sending configured
Installation
Configuration
DSN
| Part | Description |
|---|---|
ACCOUNT_ID |
Your Cloudflare Account ID |
API_TOKEN |
A Cloudflare API token with Email Sending permission |
Symfony Mailer (config/packages/mailer.yaml)
Register the transport factory (config/services.yaml)
Usage
Handling bounces
Unlike most email providers (which report bounces asynchronously via webhooks), Cloudflare includes permanent bounce information directly in the API response. This bridge surfaces it via a Symfony event so your application can react immediately.
How it works
A bounce — even a total one — is a business failure, not a transport failure. The API call itself succeeded. No exception is thrown; your listener decides what to do.
Registering the listener
Treating a total bounce as a fatal error
If your use case requires an exception when nobody received the email, throw it yourself inside the listener:
Inspecting results without a listener
SentMessage::getDebug() always contains a human-readable summary visible
in the Symfony web profiler:
Supported features
| Feature | Supported |
|---|---|
| Plain text body | ✅ |
| HTML body | ✅ |
| CC / BCC | ✅ |
| Reply-To | ✅ |
| Attachments | ✅ |
Inline images (cid:) |
✅ |
| Custom headers | ✅ |
| Bounce detection | ✅ (synchronous, via event) |
| SMTP | ❌ (API only) |
Known limitations
Recipient display names are not supported. The Cloudflare REST API only accepts plain email addresses for to, cc, and bcc fields. If you set new Address('[email protected]', 'John Doe') as a recipient, only [email protected] will be sent — the display name John Doe will not appear in the delivered email's To header.
The sender (from) supports display names via the {"address": "...", "name": "..."} format.
Maximum 50 recipients combined across to, cc, and bcc. An InvalidArgumentException is thrown before the API call if this limit is exceeded.
Single Reply-To address. If multiple reply-to addresses are set, only the first one is sent.
Domain setup
Before sending, your domain must be onboarded in Cloudflare Email Sending. Cloudflare will add the necessary DNS records (MX, SPF, DKIM, DMARC) automatically. See the official documentation.
Development
License
MIT — see LICENSE.