karlsfre
asked on
Keep Return-Path header in Postfix
We use Postfix to send emails from Java (Tomcat). We want to give each outgoing message a unique Return-Path header, so that our system automatically can register bounced email addresses.
For example, when I send an email to test@somewhere.com I want to use a Return-Path as 1234-ieh9fj83oiu@bounce.my domain.com . And when I send an email to test2@somewhere-else.com I want to use a Return-Path as 1235-oijdfoijdfj33@bounce. mydomain.c om.
I set the unique Return-Path header in the email in Java, before passing it on to Postfix through an SMTP connection. I have logged the outgoing message, and it has the correct (unique) "Return-Path" address.
However, when the email arrives to the recipient the Return-Path is set as support@mydomain.com. This is the email address used in From. It seems that Postfix automatically resets our custom Return-Path header with the From header.
I believe this is in line with the SMTP guidelines, when an SMTP server gateway sends an email it should reset the Return-Path header.
How can I configure Postfix so that it does NOT change the Return-Path header for my own emails?
For example, when I send an email to test@somewhere.com I want to use a Return-Path as 1234-ieh9fj83oiu@bounce.my
I set the unique Return-Path header in the email in Java, before passing it on to Postfix through an SMTP connection. I have logged the outgoing message, and it has the correct (unique) "Return-Path" address.
However, when the email arrives to the recipient the Return-Path is set as support@mydomain.com. This is the email address used in From. It seems that Postfix automatically resets our custom Return-Path header with the From header.
I believe this is in line with the SMTP guidelines, when an SMTP server gateway sends an email it should reset the Return-Path header.
How can I configure Postfix so that it does NOT change the Return-Path header for my own emails?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Just for reference, if someone else is looking to send emails from Java via SMTP, use com.sun.mail.smtp.SMTPMess
Open in new window