Link to home
Start Free TrialLog in
Avatar of pdbishop
pdbishop

asked on

Set PostFix Return-Path

How do I explicitly set the Return-Path to bounce@mydomain.com in Postfix?
This is a real mailbox for collecting bounces.

At the moment Postfix is automatically setting it to the From field from the email app.

Setting the Return-Path via the email app is no good. Doing so allows the headers to display a correct Return-Path but Postfix won't bounce to it.

I've looked at Flags, Canonical Maps - but not sure what I'm doing here.

I would love an example.
Avatar of David Beveridge
David Beveridge
Flag of Australia image

Have you looked at
http://www.postfix.org/VERP_README.html
and I assume you been looking at
http://www.postfix.org/ADDRESS_REWRITING_README.html

You could just try adding a header to all non local emails usig a cidr table.
eg:
127.0.0.1             permit
192.168.1.0/24   dunno
0.0.0.0/0             prepend Return-Path: <bounce@mydomain.com>

Actually maybe you want to add the head to local mails.
127.0.0.1             permit
192.168.1.0/24   prepend Return-Path: <bounce@mydomain.com>
Do you want to collect bounces in special mailbox, not postmaster?
Parameters "bounce_notice_recipient" and "2bounce_notice_recipient" in main.cf (default postmaster).
See man bounce.
http://www.ietf.org/rfc/rfc2821.txt
says..
   When the delivery SMTP server makes the "final delivery" of a
   message, it inserts a return-path line at the beginning of the mail
   data.  This use of return-path is required; mail systems MUST support
   it.  The return-path line preserves the information in the <reverse-
   path> from the MAIL command.  Here, final delivery means the message
   has left the SMTP environment.  Normally, this would mean it had been
   delivered to the destination user or an associated mail drop, but in
   some cases it may be further processed and transmitted by another
   mail system.

So it sound to me like all you need to do is to change the MAIL FROM (Envelope) sender address.
You could still retain the From: header so the recipient sees the email come from the fromaddress.
You may also want to set a Reply-to: and/or Sender: header.
If you can't specify the envelope address in the application the you could use canonical maps to rewrite the from address to a new one.
If you were sending from the command line using sendmail you can use the -f to specify the from address.

eg
# sendmail -s subject -f from@address.com to@address1.com to@address2.com
To: bob, john, mike
From: dave

Message Text
.


Note that specifying recips and from this woay on the command line does not set or change the headers which must be done as part of the message as shown above.
ASKER CERTIFIED SOLUTION
Avatar of David Beveridge
David Beveridge
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial