This Cloudflare Email Worker receives inbound email at specific civic-labs.ai addresses and forwards each message to one or more internal destination addresses.
- Cloudflare Email Routing is configured to send matching messages to this Worker.
- This Worker reads a GitHub Actions secret called
EMAIL_ROUTING, which contains a JSON mapping of source → destination addresses. - The Worker forwards each incoming email to all addresses listed for its destination.
- If a route isn’t defined in
EMAIL_ROUTING, the message is logged and ignored.
To change or add rules:
-
Update the GitHub Actions Secret
EMAIL_ROUTINGwith your new JSON mapping. Example:{ "sales@yourdomain.com": ["person1@orgA.com", "person2@orgB.com"], "contracts@yourdomain.com": ["contracts@orgB.com", "contracts@orgA.com"], "testing@yourdomain.com": ["you@orgA.com"], "contact@yourdomain.com": ["sales@orgB.com", "sales@orgA.com"] } -
Make sure all destination addresses are verified in Cloudflare Email Routing.
-
Add or update the routing rules in the Cloudflare Dashboard:
- Manage Email Routing
- Route each relevant address to this Worker (broadcast-emails)
- This method works well for a small number of static rules.
- If the routing rules expand to more than ~5 entries or require frequent changes, consider migrating them to a Cloudflare KV store.
Built in IT-532