- Create a new Email Worker with this script (modify to your needs)
- Enable catch-all in CloudFlare Email Routing and send all catch-all mail to this worker
- Make sure the forwarded emails are in fact verified to receive email forwarding
- You should still keep the "plain" custom mapping without alias enabled; like
dad => [email protected]
- ??
- Profit
This will enable using CloudFlare Email Routing to forward emails from your custom domain to your Gmail, including alias support, so e.g. all mails sent to [email protected]
will be routed to [email protected]
- including aliases like [email protected]
.
To set up Gmail to sent on behalf of your custom email domain please follow this excellent guide: https://paulonteri.com/thoughts/how-to/custom-domain-with-gmail#3-sending-mail
It appears to be working now with the added regexp to take into account to-mails containing names too. 😅