Re: [SOLVED] MTA experts: address rewriting depending on next hop
On Wed, Jul 22, 2009 at 10:20 AM, Siggy Brentrup<email@example.com> wrote:
> No, exim4 can't do it either, the reason given in
> is convincing.
Ok, your question wasn't too clear on that. I didn't know you needed
to rewrite the envelope sender based on the target domain, and quite
correctly, exim cannot do that.
I do recall doing something pretty similar at a previous employer, in
a slightly different manner. I will try and explain the setup, maybe
this can serve as inspiration.
We had three machines participating in a sort of mail network. One
machine was in a data center, receiving mail from the big bad world.
The other two lived in the offices, one in Johannesburg and one in
Cape Town, connected to the external mail server by VPN.
We also had an LDAP directory that was replicated over all three
machines, indicating what employee was in what office. We had an email
address mapping in LDAP for each employee that would map
firstname.lastname@example.org to either email@example.com or
firstname.lastname@example.org, with a rewrite rule configured in exim to
do the rewrite on the recipient. This only affected the envelope.
Finally each machine had appropriate routers so that the relevant
domain was delivered locally, the "other" one was sent to the other
office over the vpn, and anything outside company.co.za was sent to a
This way, people didn't have to know about their "internal" email
address. They simply sent email using their "official external"
address as the sender, using the other person's external address as
the recipient. If the recipient happened to be in the same office as
the sender, exim would rewrite the recipient to an internal address
and it would get delivered locally. Since the headers were never
touched, nobody was the wiser about all the trickery going on in the
Unfortunately I didn't keep a copy of the configuration files, and
I've left that employer some five years ago, so an explanation is the
best I can do here.