Postfix return Path

I am using postfix as a relay to send email from our web applications, can i set the return path on the emails in the postfix config so it is always the same.  Instead of the fromaddress of the email.  So when an email sent via postfix bounces the bounce always goes to postmaster@mypublicdomain.com

Many Thanks
LVL 11
Ross-CAsked:
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:
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 (Evnvelope) 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 header.

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
bevhostCommented:
How you actually do this will depend on the language of your web application.
eg: in php


<?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";
$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
bevhostCommented:
If you can't change the application, you can have postfix use a translation table to re-write the from addresses on the emails sent.
Create a file with the old and new addresses listed.

old@example.com    bounce@example.com
user@example.com   bounce@example.com

you can then use it as a canonical map.

For more information on this see
http://www.postfix.org/ADDRESS_REWRITING_README.html#canonical
0
bevhostCommented:
There is another header that might be worth setting for SPF purposes.  see http://www.openspf.org/

$hdrs .= "Sender: <$retpath> Web Application";
0
Ross-CAuthor Commented:
Because I was using the .net system.net.mail namespace setting the return path seperately wasn't an option.  All the above are useful thanks but in the end i purchased a reasonably priced smtp library for .net that has lots of extra properties including a return path. For anyone else who might want to do this i used aspnetemail.

Thanks
0
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.