providers.email in site.config.ts picks the transport — 'cloudflare', 'resend' or
'console'. Every message lands in email_outbox first.
The default: the EMAIL binding, no API key. It needs the Workers Paid plan; mail to a
verified destination address is free on any plan.
-
Enable sending on the domain
emailFromwill use (Cloudflare DNS zones only).Terminal pnpm exec wrangler email sending enable acme.compnpm exec wrangler email sending listpnpm cf:setupleaves the binding out while that list is empty. -
Restore the binding if
cf:setupdropped it, then regenerate types.wrangler.jsonc "send_email": [{ "name": "EMAIL" }]Terminal pnpm cf:typegenNo
remote: true;pnpm devand the tests send nothing. -
Set the provider and the sender, on the enabled domain.
site.config.ts providers: {email: 'cloudflare',emailFrom: 'Acme Directory <hello@acme.com>',},Terminal pnpm check:configA malformed sender stops at
site.config.ts › providers.emailFrom: must look like "Name <addr@example.com>". -
Deploy with
pnpm deployor a push.
For the Workers Free plan. Free tier: 3,000 a month and a hard 100 a day.
-
Add the domain
emailFromwill use in the Resend dashboard with its DNS records, and wait for “Verified” — an unverified sender gets a 403. -
Create an API key with Sending access only (it begins
re_).Terminal pnpm cf:secrets RESEND_API_KEY -
Set the provider.
site.config.ts providers: {email: 'resend',emailFrom: 'Acme Directory <hello@acme.com>',adminNotify: 'cloudflare-verified',},adminNotify: 'cloudflare-verified'routes your own mail through theEMAILbinding, off the 100-a-day cap; it needs theEMAILbinding kept, Email Routing on the zone andpnpm exec wrangler email routing addresses create you@example.com. -
pnpm check:config, then deploy.
Default when providers is deleted: nothing sends; each message logs as
email(console): to=… subject=… html=…b text=…b, row marked sent.
Verify
Section titled “Verify”| Check | Where | You should see |
|---|---|---|
| The config parses | pnpm check:config |
site.config.ts OK — … |
| Nothing is missing | /admin/ |
no email line in the report |
| A message left | submit a test listing to yourself | a receipt within a minute |
| The rows | pnpm exec wrangler d1 execute DB --local --command "SELECT template, status, attempts, last_error, created_at, sent_at FROM email_outbox ORDER BY created_at DESC LIMIT 5" (--remote for production) |
sent with a sent_at, else last_error: cloudflare E_SENDER_NOT_VERIFIED, resend HTTP 403, resend HTTP 429 |
| Per submitter | /admin/listings/<id>/, “Mail to this submitter” |
template · status · attempts · date, and its last error |
| The hourly flush, locally | pnpm build, pnpm exec wrangler dev, curl "http://localhost:8787/cdn-cgi/local/scheduled?cron=0+*+*+*+*"; under pnpm dev that URL answers 404 |
jobs: expireFeatured=0 flushOutbox=<n> … in wrangler’s log |
Worth knowing
Section titled “Worth knowing”- A password-reset link goes out with the request that made it; the rest waits for the hourly job (twenty rows a tick).
- After five failed attempts a row parks as
failedand/admin/says “N emails gave up after five attempts”; only “Resend” on the listing moves it. - Email Routing shows sent mail as
droppedeven when delivered; the Email Sending logs are the truth. providers.adminNotify:'same','cloudflare-verified'(theEMAILbinding beside Resend),'off'. Your own mail goes toadmin.email, elsesite.contactEmail.
When it is off or degraded
Section titled “When it is off or degraded”| Configuration | A submitter sees | /admin/ reports |
Fix |
|---|---|---|---|
providers.email: 'console' |
no mail; rows sent |
providers.email is "console": submitters get no mail, it is only logged. (warning) |
Set providers.email to "resend" or "cloudflare" in site.config.ts. |
'resend' without RESEND_API_KEY |
no mail; rows sent |
Missing secret RESEND_API_KEY — run: wrangler secret put RESEND_API_KEY (local: add to .env). Queued mail stays in email_outbox. (error) |
pnpm cf:secrets RESEND_API_KEY |
'cloudflare' without the EMAIL binding |
no mail; rows sent |
nothing; only cf:setup |
enable the domain, restore the binding, pnpm cf:typegen, deploy |
'cloudflare', domain not enabled or Workers Free |
pending with cloudflare E_SENDER_NOT_VERIFIED: …, failed after five tries |
the failed-email line | enable the domain or the plan, then Resend |
'resend', unverified or over the cap |
pending with resend HTTP 403 … or resend HTTP 429 rate limited … |
the same | verify the domain; the cap clears itself |
adminNotify: 'cloudflare-verified' without the binding |
your mail goes via providers.email, against its quota |
nothing | keep the binding |
emailFrom empty or malformed |
build stops | — | site.config.ts › providers.emailFrom: required when providers.email is "resend" |
Configuration
Section titled “Configuration”providers.email, providers.emailFrom, providers.adminNotify, admin.email, queue.digestHourUtc, features.accounts — providers, admin, queue, features. providers.emailFrom is required unless the provider is console, and has to be on the enabled domain.
- wrangler.jsonc the
send_emailbinding - .env.example
RESEND_API_KEY - site.config.ts the
providersblock Directoryscripts/
- cloudflare-setup.ts drops the binding without a sending domain
Directorysrc/
Directoryserver/
Directoryemail/
- index.ts the provider selector and
adminNotify - outbox.ts
enqueueEmail,flushOutbox, the five attempts - cloudflare.ts the
EMAILbinding - resend.ts the 429 and 403 messages
- console.ts the log line
Directorytemplates/
- submitted.ts
- approved.ts
- rejected.ts
- admin-new-submission.ts
- admin-digest.ts
- password-reset.ts
- layout.ts the shared shell
- index.ts the provider selector and
- jobs.ts the hourly
flushOutbox - secrets.ts the messages
/admin/shows
Directoryactions/
- submit.ts the flush after a submission
- auth.ts the inline flush for reset links
Directorydb/
- schema.ts the
email_outboxtable
- schema.ts the
Directorytests/unit/
- email-wiring.test.ts every provider gets the binding