You set up Cloudflare Email Routing, verified the destination, sent a test message, and it landed in Gmail. Then you built a filter on “To: alias@yourdomain.com” to sort it into a label, and half your mail stopped matching. The problem is not Gmail and it is not your rule syntax. Cloudflare rewrites the SMTP envelope on the way through, so the address Gmail sees in the To header is often your real inbox, not the alias someone typed. Filters built on To: will miss catch-all traffic every time. The fix is a single line in the filter box, and this walkthrough covers it end to end.
Why To-based filters break with Cloudflare email forwarding
When someone sends to sales@yourdomain.com, that address sits in the To header of the original message. Cloudflare Email Routing does not simply relay the message untouched. It accepts the mail at its edge, then hands it to Gmail as a new delivery with the envelope recipient set to your destination address. Some clients and gateways preserve the original To; Cloudflare’s forwarding path typically rewrites it so the visible recipient reflects the destination the rule points at. Either way, you cannot rely on To: containing the alias.
What Cloudflare does preserve is the Delivered-To header, which records the address the message was actually delivered to at each hop. For a catch-all rule, that header carries the alias that triggered the match. Gmail indexes Delivered-To and lets you search it, which gives you a stable hook that survives envelope rewriting. This is the same reason mailing list managers and ticketing systems have leaned on Delivered-To for decades: it describes delivery, not the author’s intent.
There is a second trap. Each routing rule supports one destination address, and routing rules per domain are limited to 200. If you are consolidating many aliases into one Gmail inbox, To-based filters become even less reliable because multiple aliases resolve to the same visible recipient. Delivered-To keeps them distinct. And if you use the catch-all rule to catch addresses not matched by other rules, you have no per-alias rule to key off in Cloudflare, so Gmail has to do the sorting.
Building the filter that actually matches
Open Gmail, click the settings gear, and go to “See all settings” then “Filters and Blocked Addresses.” Choose “Create a new filter.” In the “Has the words” field, enter the search operator directly: delivered-to:alias@yourdomain.com. Do not put the alias in the To field. Do not wrap it in quotes unless the address contains characters Gmail misreads. Click “Create filter” and let Gmail preview the matches before you commit.
On the next screen, tick “Apply the label” and pick or create a label such as the alias name. Tick “Never send it to Spam” if this is transactional mail you cannot afford to lose. Skip “Mark as read” unless you genuinely want to lose the unread signal. If you are routing several aliases, repeat the filter once per alias; Gmail filters are cheap and explicit beats clever. For a catch-all that should land in one place, use delivered-to:yourdomain.com only if you want every alias in one label, and accept that you lose per-alias granularity.
Test with a real message, not a draft. Send from an external account to an alias that has no dedicated Cloudflare rule so the catch-all handles it. Open the message in Gmail, click the three-dot menu, and choose “Show original.” Confirm Delivered-To lists the alias. If it does not, your filter will not fire, and the cause is upstream: check that the destination address is verified, because destination addresses must be verified before rules activate. Also confirm the domain’s nameservers point to Cloudflare, since cloudflare email forwarding requires nameserver delegation to Cloudflare before it will accept mail for the domain.
Two operational details matter once filters are live. The maximum message size is 25 MiB, so large attachments are rejected at Cloudflare’s edge and never reach Gmail to be filtered. And Cloudflare Email Routing does not support sending or replying from the domain; replies from Gmail go out as your Gmail address unless you configure a separate send-as path through Google Workspace or another SMTP provider. Cloudflare Email Service groups Email Routing and outbound sending, so if outbound identity matters, plan for that side separately.
Keeping the setup clean as aliases multiply
Name filters after the alias, not the label, so a search in the filter list tells you what each one targets. Prefix them, for example “cf-alias-sales,” and you can audit the whole set in seconds. When you retire an alias, delete the Cloudflare routing rule and the Gmail filter together; a stale filter on a dead alias is harmless but confusing six months later. If you build labels for dozens of aliases, consider nesting them under one parent label so the sidebar stays readable.
Watch the interaction with other rules. A filter that labels everything from a domain can shadow the delivered-to filter depending on order, and Gmail applies filters in list order for matching actions. Put the specific delivered-to filters above broad sender filters. If you route mail into Google Workspace rather than a personal Gmail account, the same Delivered-To logic applies, but admin-level compliance rules may strip headers, so verify with “Show original” before trusting the setup.
For anything programmatic, Cloudflare Workers can process inbound mail before it ever reaches Gmail, which sidesteps filter limits entirely. Most people do not need that. The delivered-to filter handles the common case, and it costs nothing.
Build one filter with delivered-to for your busiest alias, send a test from outside, and check “Show original” before you clone the pattern across the rest. If Delivered-To shows the alias and the label applies, you have a setup that survives Cloudflare’s envelope rewriting. If it does not, fix the delivery path first: verified destination, Cloudflare nameservers, and a rule that actually matches the address. Get those three right and the filtering becomes boring, which is exactly what you want from mail routing.
Tan Solid Laptop Backpack