[EXIM] Address rewriting dependent on recipient

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Olaf Titz
Datum:  
To: exim-users
Betreff: [EXIM] Address rewriting dependent on recipient
Since this was asked here several times over the last few weeks, I
have checked that the following does work. Perhaps it should go into
the FAQ.

Problem: Mail host is in two domains which are somewhat separated, and
it is desired to show the envelope and header sending address as
coming from host HA when the message goes to domain DOMA, and as coming
from host HB otherwise.

Solution:
^.*@(HA|HB)$    \
        "${if match{$h_to:}{@(.*\\.)\?DOMA}\
             {${local_part}@HA}\
             {${local_part}@HB}}"   Ff


Shortcomings:
1. Does a simple domain pattern match, not counting actual routing. In
an ideal world this rewrite should depend on the router but this is
not possible with Exim.
2. Does not take into account messages addressed to recipients in both
domains. This would require separation of the message into two,
because of the different envelope senders.
3. Can not be tested other than by sending test messages, because
the expansion variables are not available for -brw.

1. and 2. _could_ be solved the qmail way, by routing to a transport
which re-injects the message into Exim (separating recipients along)
with a tag appended to the recipient domain, and handle that tag in a
second stage. This is just as ugly as it looks, so I don't think it is
worth a recommendation...

Olaf



--
*** Exim information can be found at http://www.exim.org/ ***