News

Because I don't do social media.

How to forward email to multiple addresses with Cloudflare Email Routing

Suggestions on using the email workers service

Cloudflare is pretty great. I use them as a registrar and DNS provider (not usually proxied, unless I'm actively preventing a DDoS), and recently had to move in a few domains I use mostly for email forwarding that had a specific forwarder to a couple of different email addresses.

While Cloudflare Email Routing is simple and easy to setup for any number of one-to-one email forwarding policies, you can't choose more than one email as the destination (email forwarded to). This was blocking me, but I was motivated to get all my domains under Cloudflare, so I looked into their Email Workers and found I could use them for that exact purpose, easily!

Basically, I just create a new Email Worker, and have the Email Routing send to that worker instead of a single email address. Here's the simple code for the Email Worker:

export default {
  async email(message, env, ctx) {
    await message.forward('email1@example.com');
    await message.forward('email2@example.com');
  },
};

And that's it! Nothing more.

NOTE: You can reuse the same email worker across domains, which is exactly what I did. Had I known I couldn't rename the email worker after it was created, I'd given it a name based on where it was redirecting to, rather than where it was redirecting from. I'm sure my OCD won't make me create a brand new email worker with the same code and a different name for it to make more sense. Certainly.

Anyway, I hope this helps you.

Thank you so much for being here. I really appreciate you!