Re: [exim] Multiple aliasfiles for virtual domains

Top Page
Delete this message
Reply to this message
Author: Marc Sherman
Date:  
To: exim-users
Subject: Re: [exim] Multiple aliasfiles for virtual domains
srunschke@??? wrote:
>
> Since my approach has the problem of not having a catchall
> aliasfile to match all the standard aliases (postmaster, etc.pp), I
> thought of enhancing it:
>
>   data = ${if exists{/etc/aliases.$domain}{${lookup{$local_part} \
>         lsearch{/etc/aliases.$domain}}} \
>         ${lookup{$local_part}lsearch{/etc/aliases}}

>
> But sadly that approach cannot work, as it only checks the catchall
> aliasfile if the specific $domain-aliasfile does not exist. Instead
> I want to have it look into /etc/aliases if the lookup into
> /etc/alias.$domain
> failed, whether the file did not exist or did not yield a corresponding
> alias - I don't (want to) care ;)


You need two routers; first a virtual-alias router that looks up in
aliases.$domain, and then the system alias router that looks up in aliases.

The typical way to to the first router is a directory (such as
/etc/exim/virtual) containing only alias files named after the domain,
so you can use dsearch in the domains condition and don't need the
exists check in data.

Here's my router:
# Route mail to our virtual hosts: each host defines an aliases file
# in the /etc/exim4/virtual directory.
virtual:
debug_print = "R: virtual for $local_part@$domain"
driver = redirect
domains = dsearch;/etc/exim4/virtual
data = ${lookup{$local_part}lsearch{/etc/exim4/virtual/$domain}}

- Marc