Route ALL email sent to a domain through a worker

Hello!

I’m trying to set up a domain in Cloudflare that will put email sent to any email address on the domain through a worker.

I have a worker set up and DNS records for email configured.

It seemed like enabling the “catch-all address” for the domain and having it set to send emails through the worker would do this:

Enable the catch-all address to set an action for all other email addresses in user.com.

But, if I try to send an email to i.e. [email protected] then I get a mail delivery failure. The response from Cloudflare is:

550 5.1.1 Address does not exist.

One thing I noticed is that in the UI, if I expand the routes tied to my email worker, it lists “Catch-All” but under “Status” I just see a loading skeleton that never resolves. Maybe there’s just a bug here?

Actually, setting up a specific email I get the same thing. I just registered this domain and set it up on Cloudflare today, so maybe I have to wait for some DNS propagation.

That should indeed accomplish the goal you’re talking about.

What is your estimated time range from when you added/configurered the worker and the catch all, and until you tried sending a message?

  • Few seconds?
  • A (few) minute(s)?
  • An hour?
  • …?

If you’re already receiving that 550 5.1.1 error, and it indicate that the error is from Cloudflare (e.g. *.mx.cloudflare.net), then the DNS propagation should have succeeded, on sender’s end.

Although many things on Cloudflare often are pushed to the edge in a time frame that appears to be instantaneously, I would generally give things a little while to propagate, just to be safe.

Can you perhaps share a screenshot of where exactly that “loading skeleton” is?

And on what exact page you’re seeing it?

If your browser is on https://dash.cloudflare.com/{ACCOUNT_ID]/{DOMAIN}/email/routing/settings, then it would only be the last part, /email/routing/settings that I’m looking for.

What is your estimated time range from when you added/configurered the worker and the catch all, and until you tried sending a message?

Initially a few minutes, but I tried again this morning (~10 hours) and got the same 550 error.

I have a custom address routing rule that works now, but the catch-all still isn’t working and returns with a 550.

Can you perhaps share a screenshot of where exactly that “loading skeleton” is?

I see it on https://dash.cloudflare.com/{ACCOUNT_ID}/{DOMAIN}/email/routing/routes

The “Status” column here never resolves to anything. The same thing happens with the “Custom addresses” section; they all have the loading skeleton.

Okay, I figured out a way to fix this!

  • Go to /email/routing/routes
  • Switch the “Catch-all address” destination to “Send to an email”
  • Save
  • Suddenly, the “Status” columns all start loading!
  • Switch the “Catch-all address” back to “Send to a worker”
  • Now it works :slight_smile:

Seems like maybe something got stuck on the Cloudflare backend and didn’t fix itself until I changed this.

Is there a more official way to report a bug than on this forum?