[Exim] Help with rewrite rule syntax

Top Page
Delete this message
Reply to this message
Author: Fernando J. Rodríguez
Date:  
To: exim-users
Subject: [Exim] Help with rewrite rule syntax
I'm trying to use some sort of virtual domains using rewrite rules.
I have a file /etc/email-domains which contains lines like:

negyser: negyser.com.ar
shortsufix: some.domain.name

When a message is received I have the envelope recipient address
rewritten from something like frodriguez@??? to
frodriguez-negyser@??? which is delivered to a local account
frodriguez-negyser.

All domains in /etc/email-domains are considered local:
local_domains = localhost:lsearch;/etc/email-domains

The rewite rule I'm using actually works but yields an entry in paniclog
saying: Rewrite of frodriguez-negyser@??? yielded unqualified
address "fail".

This is the rewrite rule in question:

*@partial-lsearch;/etc/email-domains \
"${if ! eq {$sender_ident}{kavkeeper} \
{$1-${lookup{$3}lsearch{/etc/email-domains}{$value}{fail}}@$domain} \
fail}" T


(The thrid line may be word-wrapped).
The first conditional on $sender_ident is to avoid rewriting addresses
on messages generated by some antivirus software I use.

I would like to receive advice on my using of "fail".

As as I understood the specs, if the second string of a conditional is
"fail" (without quoutes nor curly brackets), then the conditional fails
and so does the rewrire rule. Thus the last line of the rewrite rule
simply says fail.

I also think that the {fail} on the third line should really not use
curly brackets, so the lookup fails instead of succeeding and returning
the string "fail"... But if I do that, the paniclog says there are
misplaced or missing "{" or "}" which further confuses me.
I'll appreciate any clue.

Regards,