A rewrite rule is typically used in conjunction with Setup->Domain Mapping to provide the mapping method to be used to route email addresses through streams.
- Check that you are in the default stream of the realm with your domains. The upper-left corner always shows your context.
- Go to Setup : User Lookups. Add a new User Lookup. (the name doesn't really matter, I suggest "CompanyName-Rewrite")
- From the dropdown, select "Rewrite" as the type.
- At the next step, define the rule as:
- Click through and Finish.
- Go to Setup : Domain Mappings. Create a new line for each of the alias domains (if it isn't already there) and on the right, set it to use the rewrite rule ("CompanyName-Rewrite").
You can apply this rule to the primary domain as well to keep this screen looking consistent.
That will do it. The Domain Mapping is merely how the spam trap name is chosen; it doesn't affect delivery at all, the messages will be delivered to the original recipient address. This merely means that any emails to the alias domains will be processed through the same spam trap as the same username in the primary domain.