On Jul 13, 2009, at 10:06, Victor Duchovni wrote:
On Sun, Jul 12, 2009 at 11:01:01PM -0400, Daniel L'Hommedieu wrote:
Greetings, all.

I'm having trouble with a forwarded email setup, and I need to munge an
inbound recipient address.

Here's what I have set up: f...@bar.edu is forwarded to o...@rab.net.

bar.edu is running GroupWise as its email server, and GroupWise munges the recipient address for forwarded emails. When email is sent to f...@bar.edu , GroupWise munges the recipient address to be o...@rab.net. GroupWise then
forwards the email to...@rab.net.

The whole reason I'm forwarding the email is that GroupWise's IMAP server
is not compatible with OS X's Mail.app IMAP client.

When I check email at o...@rab.net, I see it as To o...@rab.net, NOT To
f...@bar.edu, as we would expect because that's what the headers say.

This means that if I group-reply, the o...@rab.net address shows up in the CC line. Nobody knows about that address, and I don't want them to know about it... I am using GroupWise's SMTP server for outbound email, and all
email shows up as from f...@bar.edu, as it should.

I am running postfix 2.3.3 at the mail server for rab.net, and I want
postfix to munge the inbound address from o...@rab.net back to f...@bar.edu .

Is that possible?

   main.cf:
        # Pick one:
        #canonical_maps = hash:/etc/postfix/canonical
        #virtual_alias_maps = hash:/etc/postfix/valias
        #virtual_alias_domains = ... set me explicitly ...
        #
        #canonical_maps = cdb:/etc/postfix/canonical
        #virtual_alias_maps = cdb:/etc/postfix/valias
        #virtual_alias_domains = ... set me explicitly ...
        #
        #canonical_maps = ldap:/etc/postfix/canonical.cf
        #virtual_alias_maps = ldap:/etc/postfix/valias.cf
        #virtual_alias_domains = ... set me explicitly ...

   canonical:
        o...@rab.net    f...@bar.edu

   valias:
        f...@bar.edu    o...@rab.net

The headers will read "f...@bar.edu", but the envelope recipient
for delivery (virtual(5) happens after canonical(5)) will still be
o...@rab.net. There are other ways of doing this, but this one is
perhaps the most natural.

Thanks Victor.

I ended up using a simple recipe in procmail, which is really probably the better way to do what I wanted anyway. Here's the recipe:

:0 fhw
* ^Received:.*bar.edu.*
| sed -e 's/o...@rab.net/f...@bar.edu/'

Sure, all of the headers get changed, but I don't really care about that - all I really care about is having the original email address in the headers, so it is of no consequence to me that the "Received" headers show that email was received for the f...@bar.edu address and not the o...@rab.net address.

FWIW I had tried the canonical map as you suggest (I thought I had mentioned that), but all that seemed to do was forward the mail back to the .edu address, which put the mail into a loop until I removed the map.

Daniel

Reply via email to