Enquiry InboxDocs

Guides

Email conversations

``bash npx wrangler email routing rules create example.com --match-type literal --match-field to \ --match-value hello@example.com --action-type worker --action-value enquiry-catalog ``

Sending. A reply goes out from the domain's reply address: the one set on /domains, or REPLY_MAILBOX@<domain> (default hello@). A website that was never added uses hello@<site>, then its parent domain. If that domain is not onboarded to Email Sending, the reply falls back to REPLY_FROM (enquiries@appneural.com). Use Send test email on /domains to check a domain. To onboard one: npx wrangler email sending enable example.com.

Receiving. Add an Email Routing rule that sends the domain's reply address to this Worker:

Terminal
npx wrangler email routing rules create example.com --match-type literal --match-field to \
  --match-value hello@example.com --action-type worker --action-value enquiry-catalog

The email() handler first forwards a copy to FORWARD_TO, so nothing is lost if storing fails. It then files the email under its enquiry, matched by In-Reply-To/References, or else by the same sender on the same website within 90 days. Mail that matches nothing becomes a new enquiry with source email. A matched enquiry goes back to unread and moves to the top of the inbox; spam stays spam. Duplicate deliveries, mail from the inbox's own addresses, and mail for paused domains are not stored. A new conversation (not a reply in a known thread) must pass the same spam rules as forms; dropped mail logs inbound_spam_dropped and is still in FORWARD_TO. Attachments are listed by name but not stored. Domains whose MX is not Cloudflare (for example Microsoft 365) cannot receive this way; give them a reply address that already has a mailbox.

Local development. next dev and wrangler dev simulate sending and log each message. To send real email, add "remote": true to the send_email binding. Test the email() handler with npm run preview (or npx opennextjs-cloudflare build && npx wrangler dev), then POST http://localhost:8787/cdn-cgi/local/email?from=…&to=… with a raw RFC 5322 message that includes a Message-ID.

Last updated 2 November 2026