Email Routing Setup for Cloudflare Worker
Regardless of your chosen deployment method, you need to configure Cloudflare Email Routing to direct incoming emails to your worker.
-
Enable Email Routing:
- Go to your domain in the Cloudflare Dashboard.
- Navigate to Email → Email Routing.
- Follow the prompts to enable Email Routing for your domain.
-
Add MX Records:
- Cloudflare will prompt you to add necessary MX records to your DNS. Ensure these are correctly configured.
-
Configure Routing Rules:
- Still in Email → Email Routing → Routing Rules.
- You need to create a catch-all rule that forwards all emails sent to your domain to your deployed Cloudflare Worker.
- Select your deployed worker as the destination.
-
Verify Your Destination Email:
- Ensure that the
default_email_addressspecified in yourEMAIL_OPTIONSis a verified destination in Cloudflare Email Routing. Cloudflare will send a verification email to this address.
- Ensure that the