This one time, at band camp, TR RCPG said:
Would someone kindly post the relevant parts of an
exim4 configuration for a machine that works as isp
with virtual domains, and different users (with
possible not empty intersection set of users for
different domains)? Some directions about combined
remote mail retrieval + web access will be
appreciated.
thankyouall in advance
I tend to use arrangements like the following:
First, the filesystem:
/etc/exim4/virt_domains/domainA:
john: fred@aol.com
joe: fred@aol.com
abuse: jane@aol.com
*: john@aol.com
domainB:
fred: john@domainA
abuse: joe
So, one alias file for each domain, stored somewhere. In the example
above, all addresses in domainA get forwarded to someone at aol.com, but
abuse@domainB gets delivered to the local user joe, while fred@domainB
ultimately gets forwarded to fred@aol.com.
Then, my domainlist is just:
domainlist virt_domains = dsearch;/etc/exim4/virt_domains
Router:
virtual_aliases:
debug_print = "R: virtual_aliases for $local_part@$domain"
driver = redirect
domains = +virtual_domains
allow_fail
allow_defer
require_files = /etc/exim4/virt_domains/$domain
data = ${lookup{$local_part}lsearch*{/etc/lfrr/exim4/virt_domains/$domain}}
file_transport = address_file
no_more
This works best on systems where virtual domains are mostly forwarded,
rather than delivered locally, though. You can do the same tricks with
SQL, if you prefer faster access once things get too big for file
lookups.
If you want users delivered locally, Wouter's advice is probably very
good. But, this is the fun and difficult part about exim - the
configuration file is not just about setting config variables that have
a predefined meaning - you get to write your own logic for an
arrangement that works for you. It can make it more difficult (except
that there are usually snippets floating around for all the common uses),
but it is also way more flexible.