[exim] Rewriting the sender address depending on the recipie…

Top Page
Delete this message
Reply to this message
Author: Crane, T
Date:  
To: exim-users@exim.org
CC: Crane, T, TPCexim@mklab.ph.rhul.ac.uk
Subject: [exim] Rewriting the sender address depending on the recipient address
Hi All,

I am attempting to rewrite the sender address depending on the recipient
address.  Despite reading the lookup/lsearch and rewrite sections of the
Exim book I can't work out how to do this. As part of the same procedure
I also want to add a Reply-To: header.

I would like to create a file containing selected recipient addresses
whose senders need to be rewritten and Reply-To: record added.  Ideally
I  would like to retain the comment parts of the RFC2822 sender address
and just rewrite the working part.

An example: If distlist1@??? is in the file of
selected recipient addresses, then the incoming message header,

From: Joe Bloggs <Joe.Bloggs@???>
To: distlist1@???

gets rewritten as,

From: Joe Bloggs <distlist1@???>
To: distlist1@???
Reply-To: Joe Bloggs <Joe.Bloggs@???>

My motivation is that distlist1 etc. are NIS aliases which expand to a
number of addresses, many of which are in the example.com DNS domain and
other domains, not the mysubdomain.example.com domain whose DNS records
I have edit access to.  Rewriting the sender address for my own domain 
enables me to preserve my existing email infrastructure and support SPF
+ DKIM signing.  I know messages can have more than one recipient and
that  Exim only has one working copy but I'm happy for the rewriting to
be done  if any of the recipients addresses (To: or CC:) in a message
match the file list.

I know that some listservers have this sort of functionality but I don't
need all the other facilities they provide, so might be overkill to have
to install and configure one just for this.

Can anyone explain how to do this or even provide a recipe?

Many thanks
Tom Crane