The aliases mechanism provides great flexibility in assigning users to a mail server. However, it places a burden on administrators to ensure that all users have an alias. Users who receive mail and do not have a valid alias will -- depending on the mail server setup -- have their mail delivered locally, on whichever mail server it arrives on or alternatively the mail will be rejected. This onus is particularly great when a new user is added to the system, in which case it is preferable for users' mail to work with minimal configuration.
A hybrid system that combines simple rules with aliases that can override the rules provides both simplicity and flexibility. New users to the system are covered by the general rules and users whose mailbox has been migrated for one reason or another are covered by their own alias. This can be achieved with the following;
Kalf regex -s1 -a<@alf.bigisp.com.> (^[a-k][^@]*)<@bigisp.com.> Kbarney regex -s1 a<@barney.bigisp.com.> (^[^a-k][^@]*)<@bigisp.com.> Kuser_map hash /etc/mail/user_map R$+ < @ $+ > $* $: $(user_map $1 $: $1 < @ $2 > $3 $) R$* $: $(alf $1 $) R$* $: $(barney $1 $) RERROR $* $#error $: $1
The rules are as for rule based multiplexing with the addition of a a map to allow per-user server assignment. This is analogous to the aliases file but is a separate map for greater flexibility. The flat file user_map is built into a hash using the command:
makemap -v hash per_user.db < user_map
The general rules will only take effect in the absence of a valid entry in user_map. Per-user server assignements are processed first and if the address to which the user_map entry points is not @bigisp.com then the more general mapping will not take place.