Regex Email Forwarding
Regex (Regular Expressions) is a powerful tool which can be used to extensively customise your aliases. Here are some details about ImprovMX's implementation.
With Regex, you can configure your alias to match a specific pattern. A common pattern that you can setup easily and quickly is the following:
In this scenario, an email sent to
email@example.com will be forwarded to richard.hendricks+
Yes, you read that correctly, we allow for substitutions in the regular expression you are using, allowing you to set up complex structures.
You might be a REGEX professional, and seeing a pattern like the one above might raise some eyebrows. Indeed, sending an email to “firstname.lastname@example.org” would match the above pattern. But in practice, we surround all the regexes entries with the start and end block (“
^” and “
$“). So when testing, the pattern is, in reality,
Standard REGEX rules apply, and you can use the dollar sign (“$”) as a substitution in the forwarded email. The number following the dollar sign starts at 1 for the first group matched (using parenthesis).
This allows you to write interesting REGEX patterns and use the matched value in your destination email. The above example is a case that both leverages REGEX patterns, substitutions and GMail “plus” sign, but depending on your organization and the destination mail server, you can create one alias that will handle your entire organization. If all the emails follow the same pattern
firstname.lastname, then it can be configured as
The only restriction that applies is the maximum length of the alias field, which is 150 chars.
Order of importance when matching an email
At ImprovMX, we consider four levels of importance when searching for an alias, which are:
The exact match
The “Plus sign” match (more on that at the bottom of this guide)
The Regex match
The Wildcard or catch-all match
Regardless of how many aliases an email matches, only the highest priority one will be taken into consideration.
For example, take the following alias configuration for Piedpiper.com:
Here’s a sample of emails sent, and which alias they’d match based on the configuration above:
Hmm, what about the last line? Yep, this is what we call the “Plus sign” match...
The “plus sign” match
When we receive an email that contains the “+” sign, we handle them like Gmail does, whenever possible.
This means that any email sent to us with a + sign in the left part, will be considered without it when searching for an alias.
But we go a bit further.
Since the matching email is a @gmail.com address, we already know that they work well with the plus sign too (see the below list for full list of plus sign accepted domains), so if the matching email is a @gmail.com address, and does not already have a “+” sign, we add the one we got in the original email.
Hence, sending an email to email@example.com will result in the email being forwarded to firstname.lastname@example.org.
The “+anything” part is automatically added by ImprovMX.
Note: This only works for @gmail.com domains, and not for Google Workspace domains as it would require us to test if these domains are hosted by GMail first, slowing the email processing time.
If your email provider also accepts the plus sign, don’t hesitate to let us know. We’ll add them to the list of accepted domains for the plus sign.
List of accepted domains for Regex plus sign forwarding
Note: Many of the above email systems (and corporate email services such as Google Workspace and Microsoft 365) can accept plus addressing on a custom domain. However, this has not been implemented on ImprovMX's side as it would require us to test if these domains are hosted by Google / Microsoft first, increasing the email processing time.
Still have questions?
If you have any other queries please get in touch with our support team.