Skip to content

Add Cloudflare Email Sending #883

Draft
lylo wants to merge 12 commits into
mainfrom
cloudflare-email
Draft

Add Cloudflare Email Sending #883
lylo wants to merge 12 commits into
mainfrom
cloudflare-email

Conversation

@lylo

@lylo lylo commented Apr 4, 2026

Copy link
Copy Markdown
Owner

Summary

Introduces Cloudflare Email Sending as an alternative email delivery method, switchable per-blog via a feature flag.

  • Custom delivery method (CloudflareEmail::DeliveryMethod) sends mail via the Cloudflare Email Sending API, registered as a standard Action Mailer delivery method in an initializer
  • Per-blog routing — an after_action on MailpaceMailer checks for the cloudflare_email feature flag on the blog and swaps the delivery method on the message before it's sent. No flag = default MailPace delivery, so this is a no-op for existing blogs
  • Env vars — requires CLOUDFLARE_EMAIL_API_TOKEN and CLOUDFLARE_ACCOUNT_ID

Notes

  • The from field supports both plain addresses and display-name addresses per the Cloudflare API spec
  • EmailSubscriptionConfirmationMailer now caches @blog so it's available to the after_action callback

Test plan

  • Enable cloudflare_email feature on a test blog and verify subscription confirmation emails are delivered via Cloudflare
  • Verify blogs without the feature flag still send via MailPace
  • Verify missing env vars gracefully skip the routing (no error)

lylo added 3 commits March 25, 2026 17:05
Implements a custom ActionMailer delivery method backed by the Cloudflare
Email Sending API. Enable per blog by adding "cloudflare_email" to the
blog's features array via admin. Falls back to MailPace for all other blogs.
Move Cloudflare routing logic out of MailpaceMailer into a concern that
individual mailers include. Add it to AccountVerificationMailer for login
emails as the initial test case.
@lylo lylo force-pushed the cloudflare-email branch from 75d8127 to f6aac5b Compare April 4, 2026 13:25
@lylo lylo changed the title Add Cloudflare Email Sending as a per-blog delivery method Add Cloudflare Email Sending Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant