Repository navigation
feat(mail): send through Cloudflare Email Service on the managed cloud - #81
Merged
Merged
Conversation
The managed cloud sends transactional mail through the Worker's send_email binding instead of an SMTP or Resend credential. Nothing changes for self-hosted installs: the provider is chosen only when the binding exists or MAIL_PROVIDER names it.
Architecture Inside the changed components — 1 viewComponent view — Cloudflare Mail Delivery Internal components handling Cloudflare Worker email binding resolution and delivery
Data flow Tip Add 🪧 More tips
Thanks for using PR Lens! It's free for OSS. If it helped, a star helps other teams find it. |
The thrown message already carried only the refusal code, but the original error rode along as `cause`, and its text can quote the recipient. Loggers print a nested cause, so the address came back. Drop the cause, as the Resend provider does, and cover it with a test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The managed cloud now sends transactional mail (verification, password reset, invitations) through Cloudflare Email Service. A new
cloudflaremail provider, chosen withMAIL_PROVIDER=cloudflare, sends through the Worker'ssend_emailbinding.apps/web/wrangler.jsoncdeclares theEMAILbinding and setsMAIL_PROVIDERandMAIL_FROM=noreply@code-zero.dev. Self-hosted installs are unchanged:console,resend, andsmtpbehave as before.Why
On Cloudflare the binding is the credential, so the cloud needs no SMTP password or Resend key to rotate. A Worker receives its bindings with each request, so
apps/webreadsEMAILper request (server/utils/mail-binding.ts) and hands it topackages/mailas a callback.packages/mailstays free of Nitro and Cloudflare runtime imports, and selectingcloudflarewithout the binding fails with a message that names the missing piece.Verification
aube run check:repoaube run lint:ciaube run typecheckaube testaube run buildSafety and compatibility
observemode as read-only, or explained the policy change above.Agent context
feat/cloudflare-emailbranch, which still carried the pre-squash commits of feat(dashboard): run the dashboard as a Cloudflare Worker #80. It dropped the inbound forwarding that branch had added and then reverted, and it checked thatcode-zero.devis enabled for Email Sending in the Cloudflare account.Reviewer notes
app.code-zero.devwas deployed frommainand has noEMAILbinding. The next dashboard deploy adds it. Sending is enabled forcode-zero.dev, but the first real verification or reset mail is worth watching.email()handler is needed.

Confidence Score: 5/5
The PR appears safe to merge; no actionable defects were established.Reviews (3) · Last reviewed commit: "Merge branch 'main' into feat/cloudflare..." · Reviewed by Greptile