Skip to content

Email routing rules

In Email Routing, a routing rule matches an incoming recipient (to) address on your domain and applies an action:

  • Forward to a verified email address
  • Send to a Worker with an email handler
  • Drop the message without forwarding it

This lets you route incoming emails sent to specific custom addresses on your domain to your preferred inbox, process them with a Worker, or discard them. You can create multiple routing rules to route different recipient addresses to different destinations. Routing rules match the recipient address only — to apply logic based on the sender (from) address, route the recipient address to a Worker.

Destination addresses

Routing rules that use the Send to an email action forward messages to a verified destination address. Before you create a forwarding rule, add and verify at least one destination address. Refer to Destination addresses.

Rules that use Send to a Worker require a deployed Worker with an email handler, and rules that use Drop do not require a destination.

Routing rules

  1. Log in to the Cloudflare dashboard ↗︎ and select your account and domain.

  2. Go to Compute > Email Service > Email Routing > Routing Rules.

    Go to Email Routing ↗
  3. Select Create routing rule.

  4. In Email pattern, enter the local part of the recipient email address you want to match (for example, my-new-email), and select your domain.

  5. In the Action drop-down menu, select what this routing rule should do. Refer to Routing rule actions for more information.

  6. If you selected Send to an email or Send to a Worker, select the verified destination address (for example, your-name@gmail.com) or Worker in Destination. To add a new destination address, refer to Add a destination address. If you selected Drop, no destination is required.

Routing rule actions

When creating a routing rule, you must specify an Action:

  • Send to an email: Forwards emails to a verified destination address.
  • Send to a Worker: Sends emails to a Worker with an email handler.
  • Drop: Discards emails matching the rule without forwarding them. This can be useful if you want to make an email address appear valid for privacy reasons.

Disable a routing rule

  1. In the Cloudflare dashboard, go to Compute > Email Service > Email Routing.

    Go to Email Routing ↗
  2. Select Routing Rules.

  3. Identify the routing rule you want to pause, and toggle the status button to Disabled.

Your routing rule is now disabled and no longer matches incoming emails. If the catch-all rule is enabled, emails sent to this address fall through to the catch-all rule. Otherwise, Email Routing rejects them. To re-enable the rule, toggle the routing rule status button to Active.

Edit a routing rule

  1. In the Cloudflare dashboard, go to Compute > Email Service > Email Routing.

    Go to Email Routing ↗
  2. Select Routing Rules.

  3. Identify the routing rule you want to edit, and select Edit.

  4. Make the appropriate changes to the rule.

Delete a routing rule

  1. Log in to the Cloudflare dashboard ↗︎ and select your account and domain.
  2. Go to Compute > Email Service > Email Routing > Routing Rules.
  3. Identify the routing rule you want to delete.
  4. Select Delete and confirm the action.

Catch-all rule

Enabled named routing rules always take precedence over the catch-all rule. When you enable the catch-all rule, Email Routing applies its configured action — Send to an email, Send to a Worker, or Drop — to any incoming email sent to your domain that does not match an enabled named routing rule. For example, if you have an enabled rule for info@example.com and a sender sends mail to ifno@example.com, the catch-all rule handles ifno@example.com, while info@example.com continues to match its named rule.

To enable the catch-all rule:

  1. In the Cloudflare dashboard, go to Compute > Email Service > Email Routing.

    Go to Email Routing ↗
  2. Select Routing Rules.

  3. Enable Catch-all rule, so it shows as Active.

  4. In the Action drop-down menu, select what to do with these emails. Refer to Routing rule actions for more information.

  5. Select Save.

Subaddressing

Email Routing supports subaddressing, also known as plus addressing, as defined in RFC 5233 ↗︎. This enables using the "+" separator to augment your routing rules with arbitrary detail information.

You can enable subaddressing at Compute > Email Service > Email Routing > Settings.

Once enabled, you can use subaddressing with any of your routing rules. For example, if you send an email to user+detail@example.com it will be matched by the user@example.com routing rule. The +detail part does not affect rule matching, but it is preserved in message.to and can be inspected by a Worker, an Agent application ↗︎, or via the activity log.

If a routing rule for user+detail@example.com already exists, it takes precedence over the rule for user@example.com. This prevents breaking existing routing rules and allows certain sub-addresses to be captured by a specific rule.

Configure rules with Wrangler

If your routing rules send mail to a Worker, you can define them in your Worker's Wrangler configuration file instead of creating them in the dashboard. Add the inbound addresses to the top-level addresses field:

This feature requires Wrangler 4.113.0 or later.

{
  "$schema": "./node_modules/wrangler/config-schema.json",
  "name": "my-worker",
  "main": "src/index.ts",
  "upload_source_maps": true,
  // Set this to today's date
  "compatibility_date": "2026-12-01",
  "addresses": [
    "support@example.com",
    "*@example.com"
  ]
}
name = "my-worker"
main = "src/index.ts"
upload_source_maps = true
# Set this to today's date
compatibility_date = "2026-12-01"
addresses = ["support@example.com", "*@example.com"]

Each entry is either a literal recipient address (for example, support@example.com), which creates a routing rule for that address, or a *@domain catch-all (for example, *@example.com), which configures the catch-all rule for that domain. Catch-all entries support apex domains only. To route mail sent to an Email Routing subdomain, list each literal recipient address, such as support@mail.example.com.

Every entry uses the Send to a Worker action to route mail to the Worker you are deploying.

The addresses field is top-level only and applies to every environment of the Worker. Wrangler ignores addresses values under env.

If you omit addresses, Wrangler does not change Email Routing rules. If you set addresses to an empty array, Wrangler removes every Email Routing rule managed by this Worker.

When you run wrangler deploy or wrangler triggers deploy, Wrangler reconciles the Email Routing rules for the addresses you listed. It adds rules for new entries, updates the rules it manages, and removes managed rules that are no longer listed. Wrangler prints the planned changes and asks you to confirm before applying a destructive change, such as deleting or taking over a rule. In non-interactive environments, Wrangler does not apply destructive changes and exits with an error after deploying the Worker.

To validate your local configuration without deploying or checking remote rules, run wrangler deploy --dry-run.

Next steps

Was this helpful?