info.mailtraq.com > Incoming Mail > Re-writing
The Re-writing tab appears on the Inbox Properties dialog and is used to modify recipient addresses during message routing.
Address re-writing entries consist of a specification and a replacement. Each recipient address processed during routing is compared against each re-writing entry, and is replaced if it matches a specification. The specification is a string which can include wildcard characters.
The addresses are processed top to bottom in the order shows in the list box and the same address can be modified more than once. In fact, the same message may go through the routing system more than once as well, which may result in the same rewriting rules being applied more than once.
Mailtraq also supports the use of an aliases file (similar to the Unix .forward file) which can be used to modify addresses in the RCPT Routing Field.
String matches in address rewriting are case insensitive and local addresses can be referenced without the full host name, that is, in non FQDN (Fully Qualified Domain Name) form. Address re-writing modifies addresses in the RCPT Routing Field, analogous to the SMTP envelope forward path, and does not alter headers in the re-routed message.
Rewriting rules are applied to Mailtraq's Domain Name and Domain Aliases indiscriminately. That is, an address rewriting specification which specifies email@example.com is also applied by Mailtraq to all the entries in firstname.lastname@example.org. A more technical explanation is that Mailtraq canonicalises local domains in both specification and replacement expressions and in the inbound message before comparing them. Hence if Mailtraq considers both sales.host and tech.host to be local domains, mail re-writing cannot be used to distinguish between them in order to direct messages for email@example.com to a different destination from firstname.lastname@example.org.
Host names can be treated as non-local by Mailtraq if they are removed completely from the Server Properties dialog and added in *@domain form to the 'Always allow relaying to these recipients' field on the Relaying tab of the primary SMTP Service. Obviously, considerable care is needed when handling address re-writing in that way to avoid mail being misrouted and it should not be embarked on lightly by the inexperienced. Alternatively, a custom written Script may be employed, the same as, or similar to, the fully worked Example Script which treats all domains as non-local for address re-writing purposes.