Quoth Marc Haber on Mon, Jan 21, 2002:
> On Sun, 20 Jan 2002 20:13:51 +0100, Phil Pennock
> <Phil.Pennock@???> wrote:
> > new_address = ${lookup{$local_part} lsearch* {/etc/aliases} {$value${if def:local_part_suffix {+$local_part_suffix}{}}}fail}
Let me shout "Configuration example C022!" again for the third
time for the last two weeks ;)
> *yuck*
>
> This is something that I positively hate with exim: String expansion.
No worries, in Exim 4 aliasfile, smartuser and forwardfile are
the same, and the processing of /etc/aliases has a little cute
string expansion.
> Worse than perl with leaning toothpick syndrome. However, when it does
> what I want it to do, it is fine ;)
>
> Since $local_part_suffix contains the "+", your new_address expression
> is a little buggy, and can be shortened to $value$local_part_suffix.
> This handles the cases "mailbox+foo", "mailbox" and "first.last+foo"
> just fine.
You're right, of course.
Additionally, you may want to handle aliases that have domains.
This is similar to what I use:
new_address = ${lookup{$local_part}dbm{/etc/aliases}\
{${local_part:$value}$local_part_suffix@\
${if eq{${domain:$value}}{}{$domain}{${domain:$value}}}}fail}
> For the mailbox+bar case with the explicit alias, a suffixless
> director is needed, giving
>
> system_aliases:
>
> system_aliases2:
>
> to solve the task presented.
True indeed.
Vadik.
--
Avoid reality at all costs.