Hi, i have here postfix 2.6.5 on Ubuntu. Outgouing mails are sent via an external SMTP Server (relayhost..). When i send an email from a local user to a real email address i have in the email header "Return-Path: root@SERVER_NAME". So i can't get back any bouncing or error mails.. I use the server mainly for websites so when i send mails via the webserver then i have the same problem, the envelope sender is "www-data@SERVER_NAME" (i know i could change this via PHP-Mail command but i'm using a CMS and i won't change that..) So i tried to masquerade ONLY the envelope sender address. For this i use Canonical address mapping. /etc/postfix/main.cf: sender_canonical_classes = envelope_sender sender_canonical_maps = hash:/etc/postfix/sender_canonical
/etc/postfix/sender_canonical: @SERVER_NAME i...@example.org Now if i do as root or as any other local user: mail -s testoMail local_user < mailContent.txt then not only the envelope sender (Return-Path) gets changed, but also the *header_sender (From: ..)* this is the source-code of the mail; >From masquera...@example.org Wed Jan 26 10:00:48 2011 Return-Path: <masquera...@example.org> X-Original-To: local_user@SERVER_NAME Delivered-To: local_user@SERVER_NAME Received: by SERVER_NAME (Postfix, from userid 0) id 7C11D255B447; Wed, 26 Jan 2011 10:00:48 +0100 (CET) Subject: testmail To: <local_user@SERVER_NAME> X-Mailer: mail (GNU Mailutils 2.0) Message-Id: <20110126090048.7C11D255B447@SERVER_NAME> Date: Wed, 26 Jan 2011 10:00:48 +0100 (CET) From: masquera...@example.org (root) mailContent.. so why does postfix also masquerade the From: header if i set in "sender_canonical_classes = envelope_sender"? I tried this on another postfix server (version 2.5.1) and there the problem doesn't exist. Also interesting is that if i set the FROM header via the unix mail command (for example: mail -a "FROM: root@SERVER_NAME" -s testoMail local_user < mailContent.txt) then only the envelope sender get changed. I'm very confused now and i hope someone can help me. I'm also interested if someone has a better approach of doing this. Maybe i should also note that my Unix hostname (/etc/hostname) is different than "myhostname" in postfix, but i think thats no problem? Georg