[exim] Selecting rewriting flags based on a condition

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Mike Brudenell
Ημερομηνία:  
Προς: Exim Users
Αντικείμενο: [exim] Selecting rewriting flags based on a condition
Hi, all -

I can't spot an elegant (or indeed any) way of doing this at the moment;
can anyone help? …

I have a rewriting rule in the *begin rewrite* section:

noreply@??? no-reply@??? Eh


I'd like to rewrite both Envelope and header addresses if the connection is
from an on-site IP address, but only the Envelope otherwise.

I assumed I could just change the Eh flags to something like

${if match_ip{$sender_host_address}{144.32.0.0/16} {Eh} {E}}

But

- Trying this gives an error in the panic log as Exim starts up saying
"$" is an unknown flag;
- Enclosing the expression within double quotes also fails, this time
saying '"' is an unknown flag.

So it looks like that whilst the pattern and replacement strings are
expanded the flags aren't. (The documentation says that the pattern and
replacement strings are expanded, but doesn't mention this for the flags.
I'd lived in hope! :-)

Does anyone know a way (ideally simple/elegant!) of achieving this
selective rewriting? (I'll probably want to extend the test to include
authenticated connections as well, but am starting just with IP addresses.)

*Use-case:* After having problems delivering mail to another is which is
rewriting headers of incoming messages form off-site and thereby breaking
DKIM signatures I thought I should get my own house in order too and only
rewrite the headers for messages coming from on-site systems.

With many thanks,
Mike B-)

--
Systems Administrator & Change Manager
IT Services, University of York, Heslington, York YO10 5DD, UK
Tel: +44-(0)1904-323811

Web: www.york.ac.uk/it-services
Disclaimer: www.york.ac.uk/docs/disclaimer/email.htm