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.
pdbishopAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bevhostCommented:
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>

0
bevhostCommented:
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>
0
tty2Commented:
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.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

bevhostCommented:
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.
0
bevhostCommented:
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.
0
bevhostCommented:
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.
0
bevhostCommented:
In php you could do it like this...
<?php
$recip_email = "someone@somedomain.com";
$recip_fullname = "Some One";
$hdrs = "To: <$recip> $recipfullname";
$hdrs .= "From: <user@example.com> User Name\r\n";
$hrds .= "Reply-to: <user@example.com> User Name\r\n";
$hrds .= "Sender: <apache@someserver.net> Apache Web Server\r\n";
$msg = "this is the body";
$sbj = "email message"
$retpath = "bounce@example.com";

mail  ( $recip_email ,  $sbj  ,  $msg ,  $hdrs , "-f $retpath");

?>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Email Servers

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.