EmailCatchAll
Source:
src/Cloudflare/Email/EmailCatchAll.ts
The Cloudflare Email Routing catch-all rule for a zone.
The catch-all rule handles every inbound email that no other routing
rule matched. It is a per-zone singleton — once Email Routing is enabled
the rule always exists (disabled, dropping mail, by default), so this
resource never creates or deletes anything physical. Reconcile PUTs the
desired configuration; destroy restores the configuration the rule had
before Alchemy first managed it.
Email Routing must be enabled on the zone first (see
Cloudflare.EmailRouting), and forward actions require the destination
address to be verified (see Cloudflare.EmailAddress).
Catching unmatched mail
Section titled “Catching unmatched mail”Forward everything else to a verified destination
const routing = yield* Cloudflare.EmailRouting("Routing", { zone: "example.com",});
yield* Cloudflare.EmailCatchAll("CatchAll", { zone: routing.zoneId, actions: [{ type: "forward", value: ["ops@example.com"] }],});Silently drop unmatched mail
yield* Cloudflare.EmailCatchAll("DropTheRest", { zone: routing.zoneId, name: "drop unmatched", actions: [{ type: "drop" }],});Workers
Section titled “Workers”yield* Cloudflare.EmailCatchAll("CatchAllWorker", { zone: routing.zoneId, actions: [{ type: "worker", value: ["my-email-worker"] }],});