Skip to content
Nigel Metheringham edited this page Nov 29, 2012 · 2 revisions

Q0425


`Navigation(siblings)`_


Q0425

Question

My users' mailboxes are distributed between several servers according to the first letter of the user name. All the servers receive incoming mail at random. I would like to have the same configuration file for all the servers, which does local delivery for the mailboxes it holds, and sends other addresses to the correct other server. Is this possible?

Answer

It is easiest if you arrange for all the users to have password entries on all the servers. This means that non-existent users can be detected at the first server they reach. Set up a file containing a mapping from the first letter of the user names to the servers where their mailboxes are held. For example:

a: server1
b: server1
c: server2
...

Before the normal localuser router, place the following router:

mailbox_host:
  driver = manualroute
  check_local_user
  transport = remote_smtp
  route_list = * ${lookup{${substr_0_1:$local_part}}lsearch{/etc/mapfile}}
  self = pass

This router checks for a local account, then looks up the host from the first character of the local part. If the host is not the local host, the address is routed to the remote_smtp transport, and sent to the correct host. If the host is the local host, the self option causes the router to pass the address to the next router, which does a local delivery. The router is skipped for local parts that are not the names of local users, and so these addresses fail.


Clone this wiki locally