[Exim] rewriting from: depending on to: or cc:, file lookup …

Top Page
Delete this message
Reply to this message
Author: Michael Renzmann
Date:  
To: exim-users
New-Topics: [Exim] File lookups in rewrite rules?
Subject: [Exim] rewriting from: depending on to: or cc:, file lookup in rewrite rules?
Hi all.

After a lot of experimentation and successful digging in the list
archives via google, I finally managed to get some rewrite rules to
accomplish the following task:

The from:-field for mails that have a given address in either the to: or
the cc:-field will be rewritten to another (local) address.

You might ask for the use of this behaviour: I'm subscribed to several
mailing lists that only accept messages from members. For every
subscription I use a distinct mail address for several reasons, but when
writing to such a list I sometimes forget to properly adjust the
from:-field. That results in additional work for the list admin, which I
want to avoid.

As stated above, I successfully set up rules that do what I want. One
example:

real@??? \
   "${if or {{match {$header_to:}{exim-users@???}} \
             {match {$header_cc:}{exim-users@???}} \
             {match {$header_to:}{exim-users-request@???}}} \
             {exim-users@???}fail}" Ffrs


If I forget to adjust from:, the mail comes from my "real" e-mail
address real@??? (which is just an example). In case the mail is
directed to this list (or exim-users-request) from: will be adjusted to
exim-users@???.


Since sooner or later there will be a lot of rules (depending on the
amount of lists I'm subscribed to), I wonder if it is possible to make
these stuff a little easier to administrate.

So we come to the following question: is it possible to use just some
general rules that look up every part of to: and cc: in a file, and if
the address is found in the file, the rule uses a value that is given
there? An example for the "lookup file" I have in mind:

exim-users@???    exim-users@???


The first part of the line is the list address, the second is the mail
address that from: should be changed to if the list address is contained
in either to: or cc:.

Is that possible? And if so, how could I do this (examples)?

Bye, Mike