BETA: Rules Routing

How to create custom routing rules for ImprovMX email forwarding.

NOTE: This feature is in early-release beta mode. Expect some kinks that we'll be working out!

NOTE: Rules Routing is a paid-account feature.

Looking for API methods? Find them here.

ImprovMX lets you craft fully customizable routing rules to intelligently route incoming emails.

For example:

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

These powerful rules can be configured intuitively from our domain dashboard.

Enabling Rules Routing

Visit your domain's custom settings page, and select Rules Routing from the dropdown. Your normal alias interface will now change to a rules routing interface.

Alias Rules

Alias rules recreate the classic Alias Routing experience. For example, richard@piedpiper.com -> richard.hendricks@gmail.com

Regex Rules

Regex rules let you match arbitrary text in the email's subject, body, sender, or recipient using regular expressions.

In the following example, we match any email with Order Confirm or Payment Confirm in the subject, and route to account@piedpiper.com. This is done using by checking the subject checkbox and inputting the following regex: .*(Order Confirm|Payment Confirm).*.

You can select multiple checkboxes, which try to match the string against any of the email's subject, body, sender, or recipient. We suggest using regex101.com to test out your regex against test text.

CEL Rules

CEL is a fully customizable Domain Specific Language (DSL) that allows you to write complex logic.

In this example, emails with finance  in the subject and not to richard@piedpiper.com are routed to monica@piedpiper.com .

The four objects we currently support are:

  • subject
  • body
  • sender
  • recipient

A few common CEL functions are:

  • subject.contains('text') matches if the subject contains text
  • subject.endsWith('suffix') matches if the subject ends with suffix
  • subject.startsWith('prefix') matches if the subject starts with prefix
  • subject.matches('.*Hello.*') matches if the subject matches the regular expression .*Hello.*

A few common CEL operators

  • && the AND operator
  • || the OR operator
  • ! the NOT operator

See the full language definition, the possibilities are endless! We understand constructing these rules can be pretty complicated—please reach out to support if you need help!

Rule Rank

Each rule has an associated rank. On each incoming email, we evaluate all your rules in rank order (lowest first), and the first matching rule will deliver the email to that rule's destination.

You can change a rule's rank via the UI or via the API.

Rule Destination

Specify an email address for each rule. Or specify multiple addresses, null, and/or webhooks. This follows the same convention as our alias destinations.

Fall Through Rule

What happens if no rules match for a given email? It fall through to the "All Unmatched Emails" rule, which defaults to the email of your account. You can change this, or set it to null to drop all unmatched emails.

Thank you for using our Rules Feature. If you have any issues or feedback, please reach out to us!