Avalonia MailRouter redirect keyword

redirect lines are a bit more flexible, as they are used for redirecting mail sent to several email addresses into a single email address, or to redirect the mail to another domain:

redirect cust1.dk cust1@avalonia.dk
redirect postmaster postmaster@avalonia.dk
redirect cust2.dk cust2.com
redirect olddomain.net -
redirect a@mail.bigcomp.dk mail01.bigcomp.dk
redirect b@mail.bigcomp.dk mail02.bigcomp.dk

Here the first line redirects all messages sent to email addresses on the domain "cust1.dk" to "cust1@avalonia.dk", then all messages to all postmasters on all domains handled by MailRouter are forwarded to "postmaster@avalonia.dk" and all messages to the domain "cust2.dk" are redirected to the domain "cust2.com". If any messages are sent to an account on the domain "olddomain.net", those messages will be deleted unread. The two last lines redirects all mail to the domain "mail.bigcomp.dk", where the accounts begin with an "a" to the server "mail01.bigcomp.dk", and to "mail02.bigcomp.dk" if the accouts start with a "b".

The patterns used in MailRouter can belong to one of three categories:

<pattern1> can contain untyped wildcards, that can be used to select several accounts or domains. The two last lines in the example shows how to use an untyped wildcard for splitting mail up between different servers. Actually all lines in the example has an untyped wildcard, as "cust1.dk" accepts all domains ending with "cust1.dk", and "postmaster" accepts all accounts beginning with "postmaster".
In some patterns the wildcard can be prevented, by adding a "@" character in front of a domain, or at the end of an account, as shown in the following example:

redirect @cust1.dk cust1@avalonia.dk
redirect postmaster@ postmaster@avalonia.dk
redirect @cust2.dk cust2.com

where only messages sent to addresses in the domains "cust1.dk" and "cust2.dk", or with the account "postmaster" are redirected.

When full addresses are used as <pattern1> in a redirect line, MailRouter always uses an untyped wildcard just before and after the "@". As an example:

redirect info@cust1.dk cust1info@avalonia.dk

will redirect all messages to all addresses in the domain "cust1.dk", and all subdomains, beginning with "info", such as "info@cust1.dk", "information@sales.cust1.dk" and "inform@info.cust1.dk", to "cust1info@avalonia.dk".

The rest of the patterns on each line (<pattern2>) are used for describing the destination of the messages, that match <pattern1>. The messages can be forwarded to a full address, but by only giving an account, the message can be forwarded to another account on the same domain. By only giving a domain, the message will be rerouted to another mail server.

redirect cust1.dk cust1@avalonia.dk
redirect cust2.dk cust2.com
redirect info@ postmaster

In this example the first line redirects all messages sent to email addresses in the domain "cust1.dk" to "cust1@avalonia.dk", all messages to the domain "cust2.dk" to the domain "cust2.com", while all messages sent to an address managed by MailRouter with the account "info" will be rerouted to the "postmaster" accounts on the same domains.
As <pattern2> normally have no need for wildcards, "@" signs at the beginning or end of words will be ignored.

When handling domains with many users, that keep changing, setting up separate aliases for each user can become quite time consuming. To make this easier, a single redirect line can be used to automatically redirect all mail to a domain into individual mailboxes:

redirect cust1.dk .cust1@avalonia.dk
redirect cust2.dk .cust2

The first line redirects all messages to accounts in the domain "cust1.dk" to accounts in the domain "avalonia.dk", with ".cust1" appended to the account. As an example messages to "peter@cust1.dk" will be redirected to "peter.cust1@avalonia.dk". The second line does the same for messages to the domain "cust2" but where the accounts redirected to are placed on the local mail server.

If <pattern2> contains an account or a full email address beginning with a ".", the message will be redirected to an address consisting of a concatenation of the original account and the pattern.



Bo Holst-Christensen (holst@cutisan.dk)