DNS & Email Setup
MX Records
Section titled “MX Records”Point your domain’s MX records to Cloudflare Email Routing:
MX yourdomain.com → route1.mx.cloudflare.net (priority 1)MX yourdomain.com → route2.mx.cloudflare.net (priority 2)MX yourdomain.com → route3.mx.cloudflare.net (priority 3)Keep Existing Outbound Sending
Section titled “Keep Existing Outbound Sending”If you use a provider like Proton Mail or Google Workspace for sending, keep your existing SPF, DKIM, and DMARC records intact:
TXT yourdomain.com → v=spf1 include:_spf.protonmail.ch ~allCNAME protonmail._domainkey... → (your existing DKIM record)TXT _dmarc.yourdomain.com → v=DMARC1; p=none; ...Cloudflare Email Routing
Section titled “Cloudflare Email Routing”- Go to your domain in the Cloudflare dashboard
- Navigate to Email > Email Routing
- Enable Email Routing if not already enabled
- Under Routing rules, create either:
- A catch-all rule → route to your Email Worker
- Specific address rules (e.g.,
contact@yourdomain.com→ Email Worker)
Verify It Works
Section titled “Verify It Works”Send a test email to your configured address. Check the worker logs:
cd workerwrangler tailYou should see the email being received, classified, and stored in D1.