[exim] headers_add in a redirect router

Top Pagina
Delete this message
Reply to this message
Auteur: Philipp Snizek
Datum:  
Aan: exim-users
Onderwerp: [exim] headers_add in a redirect router
Hi all

I am trying to do the following.
Emails from certain domains to some of my users should get copied and
re-routed to another recipient address (and recpient MTA) while the
original email stayes untouched. Please do not discuss the moral of
this. I'm not fond of it either.

In a ascii art I would draw it like that:

email sent from someuser@??? to myuser@???

            +---> rewrite recipient to catch_myuser@???
            |     and store it on some.server.mydomain.com
inet ---> exim.mydomain.com  
            |
            +---> forward email to myuser@???
                  and store it on mymailserver.mydomain.com


The Subject: must be rewritten as well. In the subject I must see the
sender and the real recipient.

The same of course I must have for outbound mails as well. That means,
mails from myuser@??? to anyuser@??? should be "catched"
and the Subject: line should be altered the same way as well.

Basically it works. Outbound emails are copied and the copy's Subject:
is rewritten as wanted. However, inbound (from inet -> lan) the Subject:
ist not rewritten. And I just don't know why.

Please give me a hint.

Thank you very much

Philipp


That's the config of exim.mydomain.com (test environment):

# copy inbound mails (checks against senders's domain and copies email
to whatever address)
copy_router_inbound:
driver = redirect
# domains = ! +local_domains
data =
"${lookup{$sender_address_domain}lsearch{/etc/eximap/myaliases}}"
headers_remove = "Subject"
headers_add = "Subject: from=<$sender_address> to=<$local_part@
$domain> 2 $h_subject:"
unseen

# copy outbound mails (checks against recipient's domain and copies
email to whatever address)
copy_router_outbound:
driver = redirect
# domains = lsearch;/etc/eximap/mssaliases
data = ${lookup{$domain}lsearch{/etc/eximap/myaliases}}
headers_remove = "Subject:"
headers_add = "Subject: from=<$sender_address> to=<$local_part@
$domain> 1 $h_subject:"
unseen

# 041214/rjm: Manual routing for example.com
remote_route:
driver = manualroute
transport = remote_smtp
route_list = * ip.address of servers
no_more