How to set Return-Path header?
1 posts in topic
Flat View  Flat View

Posted By:   Morten_Bagai
Posted On:   Sunday, March 7, 2004 08:16 PM

I am having problems setting the Return-Path header for outgoing messages using JavaMail 1.3.1

When I call the setHeader() method of the message path, an extra Return-Path header is added instead of overwriting the existing one. It seems as if JavaMail uses the from-address as the default value of the from-address for the Return-Path, and doesn't accept my overwrite.

Thanks for your help!

Re: How to set Return-Path header?

Posted By:   Christopher_Koenigsberg  
Posted On:   Sunday, March 7, 2004 10:15 PM

The "Return-Path" header, and/or "Unix From line" is written by the receiving mail agent, not the sending one. (note the "Unix From line" comes from the envelope e.g. son-of-rfc 821, not the "From:" header field of son-of-rfc 822!)

What you get, Return-Path and/or Unix From, depends on the mailbox message format at delivery/local dropoff time; you will get one or the other or maybe both.

Also note that a "Received" header should have been added at every hop, by every SMTP server along the way. So the sender field in the final Received header, written by the final SMTP server, should look very similar to the Return-Path and/or Unix From line.

It (Return-Path and/or Unix From, plus the final Received header) is based on what it (the receiving SMTP server) got, in the MAIL FROM field of the SMTP envelope, subject to whatever DNS canonicalization etc. might happen at the receiving end, distinct from what was written by the sender.

The days of complicated return paths containing UUCP bang paths, BITNET/CSNet/DECNet etc. translations are probably gone for good, but still CNAME's will be canonicalized, etc. in the sender and recipient envelope fields, before the final delivery.

If this doesn't make sense to you, then you're probably not ready to write and maintain an Internet email application, not yet.

So in your sending application you probably want to set the envelope sender field, distinct from the "From:" and/or "Reply-To:" headers.

About | Sitemap | Contact