How do I connect Email Routing with an Email Worker to nofeb?
- Enable Email Routing on the zone; Cloudflare adds its MX records.
- Deploy nofeb's Email Worker to your Cloudflare account and set two values:
NOFEB_URL(the API host) and the secretNOFEB_INBOUND_SECRET, which is your organization's inbound token fromGET /v1/me. - Bind an R2 bucket as
SPOOLand keep the cron trigger, so a message is held and redelivered if nofeb cannot be reached. - Add a routing rule, or the catch-all, with the action "Send to a Worker" and pick the nofeb Worker.
- Add the domain to nofeb and verify it, so its addresses can receive.
wrangler secret put NOFEB_INBOUND_SECRET # paste inbound.cloudflare_token from GET /v1/me
# wrangler.toml
[vars]
NOFEB_URL = "https://api.nofeb.com"
[[r2_buckets]]
binding = "SPOOL"
bucket_name = "nofeb-inbound-spool"
[triggers]
crons = ["*/5 * * * *"] How does the agent get the message?
The same three ways as any other inbound mail. Subscribe a webhook to message.received, pull the event feed, or block on wait_for_email until it arrives:
curl -X POST https://api.nofeb.com/v1/inboxes \
-H "Authorization: Bearer $NOFEB_API_KEY" -H 'content-type: application/json' \
-d '{"local_part": "signup-bot", "ttl_seconds": 3600}'
curl "https://api.nofeb.com/v1/inboxes/$INBOX_ID/wait?has_otp=true&timeout=60" \
-H "Authorization: Bearer $NOFEB_API_KEY"
# → { "message": { "subject": "Your code", "otps": [{ "code": "482913", "source": "body" }], … } } What does nofeb add to Cloudflare Email Routing's payload?
- The SMTP envelope travels with the message (the Worker sends
message.toandmessage.from), so routing follows the envelope recipient rather than the To: header. - An Email Worker cannot answer the sender with a temporary failure: rejecting is permanent and a thrown error bounces. The nofeb Worker rejects only answers that will never succeed (too large, not yours), retries briefly, then spools the message to your R2 bucket and redelivers it on the cron schedule.
- Redelivery is safe: nofeb deduplicates, so a retry after a lost acknowledgement delivers once.
- The token in the Worker can deliver only to your organization's inboxes and verified domains; mail for anyone else is refused.
What should I know about Cloudflare Email Routing itself?
From Cloudflare Email Routing's own documentation, checked .
- Rules in Email Routing have two actions, Send to an email and Send to a Worker; the docs list no direct webhook action. source: developers.cloudflare.com
- Inbound messages larger than 25 MiB are rejected by Email Routing. source: developers.cloudflare.com
- Each domain can have up to 200 rules in Email Routing, and each account up to 200 destination addresses. source: developers.cloudflare.com
- Email Workers handle mail in an email() handler that can forward, reply or reject with setReject(). source: developers.cloudflare.com
- Forwarding to verified destination addresses is free on all plans. source: developers.cloudflare.com
Frequently asked questions
Can Cloudflare Email Routing send email to a webhook?
Not directly. Rules in Email Routing forward to a verified address or hand the message to a Worker, and the Worker makes the HTTP request. nofeb's Email Worker is that request, with retries and a spool for outages.
What happens if nofeb is down when mail arrives?
The Worker retries for a few seconds, then stores the message in your R2 bucket and accepts it from the sender. The cron trigger redelivers it with backoff for up to five days; a message that still fails is moved aside and kept, never dropped.
Do I need to change my MX records?
No. Email Routing keeps its own MX records. nofeb's MX is a separate option for domains that do not use Cloudflare for mail.
Status of everything on this page
Every capability named above, with its status as reconciled against the engine.
| Capability | What it does | Status |
|---|---|---|
| Inbound from the provider you already use | Receive through Cloudflare Email Routing with an Email Worker on your own zone, a Postmark inbound stream, a Mailgun route, SendGrid Inbound Parse, or any service that can POST a raw message. Each path is authenticated by your organization's inbound token, which you can rotate at any time, and delivers only to your own inboxes and verified domains. | Shipped |
| Inbound routed by envelope recipient | Mail is delivered to the inbox named in the SMTP envelope, not the To: header, whichever way it arrives, and redelivery is idempotent. | Shipped |
| Reply extraction | Each message carries its new text with quoted history and signature removed. | Shipped |
| safe_body for untrusted mail | The message's new text with zero-width and direction-altering characters, hidden HTML and forgeable quoted history removed, wrapped in a provenance header that tells the model whose words these are. | Shipped |
| One-time code and link extraction | Verification codes and classified links are pulled out of every message and returned as fields. | Shipped |
| Attachment text | Attachments are listed with their extracted text and can be downloaded byte-exact. | Shipped |
| Wait for an email | Long-poll an inbox for up to a minute until a message matching sender, subject or has-a-code arrives. | Shipped |
| Signed webhooks with required scope | Standard Webhooks signatures, retries and a delivery log. Scope (organization, pod or inbox) is required, so a subscription never silently widens to everything. | Shipped |
| HTTPS hooks in the pipeline | Signed HTTPS callouts that change what happens: create or reject an inbox for an unknown recipient, accept, reject or quarantine a message before delivery, and allow, deny or hold a send, each with a timeout and a fail-open or fail-closed mode. | Shipped |