Rules Routing

How to create custom routing rules for ImprovMX email forwarding.

Note: Rules Routing is a paid-account feature. API methods are available in the API documentation.

ImprovMX enables you to create fully customizable routing rules to intelligently route incoming emails. For example:

  • Emails with "finance" in the subject → finances@piedpiper.com
  • Emails with "free offer" in the subject or body → trash
  • Emails with "one time code" in the subject → webhook
  • Emails with "finance" in the subject AND NOT to "richard" → monica@piedpiper.com

Enabling Rules Routing

Access your domain's custom settings page, select Rules from the toggle, and click Update. The alias interface will convert to a rules routing interface.

Rule Types

Alias Rules

Recreate classic alias routing (e.g., richard@piedpiper.comrichard.hendricks@gmail.com). Supports wildcard (*) and regex patterns:

  • *@piedpiper.com matches any alias under the domain
  • sales*@piedpiper.com matches aliases starting with "sales"

Regex Rules

Match arbitrary text in email subject, body, sender, or recipient using regular expressions. We recommend regex101.com for testing patterns.

Example: .*(Order Confirm|Payment Confirm).* matches either confirmation type in the subject.

CEL Rules

Use CEL (Common Expression Language) for complex logic. Supported objects:

  • subject
  • body
  • sender
  • recipient

Common functions:

  • subject.contains('text')
  • subject.endsWith('suffix')
  • subject.startsWith('prefix')
  • subject.matches('.*Hello.*')

Common operators: && (AND), || (OR), ! (NOT)

Rule Rank

Rules evaluate in rank order (lowest first). The first matching rule delivers the email to its destination. You can modify rank via the UI or API.

Rule Destination

Each rule specifies delivery destination(s): single or multiple email addresses, null (discard), or webhooks.

Fall Through Rule

Unmatched emails route to the "All Unmatched Emails" rule, which defaults to your account email. This can be customized or set to null to silently drop all unmatched emails.

Still have questions? Feel free to reach out to our support team!