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: [email protected] is forwarded to [email protected].
bar.edu is running GroupWise as its email server, and GroupWise
munges the
recipient address for forwarded emails. When email is sent to [email protected]
,
GroupWise munges the recipient address to be [email protected]. GroupWise
then
forwards the email [email protected].
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 [email protected], I see it as To [email protected], NOT To
[email protected], as we would expect because that's what the headers say.
This means that if I group-reply, the [email protected] 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 [email protected], 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 [email protected] back to [email protected]
.
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:
[email protected] [email protected]
valias:
[email protected] [email protected]
The headers will read "[email protected]", but the envelope recipient
for delivery (virtual(5) happens after canonical(5)) will still be
[email protected]. 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/[email protected]/[email protected]/'
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 [email protected] address and
not the [email protected] 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