|
Its also importent to know that some mailserver strip the return path if there is allready one and some not to reproduce this bug. For example postfix and sendmail seems to strip it. Qmail not.
The problem seems to be related to code in MimeMessageWrapped added by Noel on 05/05/2005 (r168238)
"revision 109187 introduced a bug where if we had a real Return-Path header its value would not be the first in the String[]. This tries to eliminate that problem. We should still test to see if this hack is necessary at all, or if InternetHeaders.setHeader("Return-Path", <value>) is smart enough in JavaMail 1.3.2 to put the header at the top, instead of in the middle." I this also the comment to r109187 is usefult: Additional adjustments to fix InternetHeaders currently works differently if created with empty constructor or from stream. In the first case it create an empty sorted list of headers to keep positions, otherwise it does it the wrong way. Changing the MailHeaders(InputStream) constructor to use the empty super constructor and calling load(is) seems to fix this difference. Norman is currently working on writing unit testing and to find a solution to this issues. This bug has been introduced by the fix to
InternetHeaders have this bugs:
1) if you load an header from stream then following addHeader will not follow "default" sorting. 2) if you add a Return-Path to headers loaded from a stream with a Return-Path in the bad place it will add the new Return-Path just before the old one, and not at the start of the message 3) if you replace a Return-Path to headers loaded from a stream with a Return-Path in the bad place it will put the new Return-Path in the same position of the old one. So we changed MailHeaders to fix this issues: 1) Changed the default constructor to use the right one from the super class and then load the stream 2) Changed the setHeader and addHeader to correctly handle the Return-Path header Then we removed all the custom routine introduced by Noel to fix the Return-Path issues that had the problem described by this issue and was no more needed with this update. This fix also allowed to remove workaround code from MimeMessageTest (it worked around the Return-Path: null). I probably have been too lazy inserting this workaround instead of trying to understand why it was there when testing. Btw all the tests now passes, feel free to test it and backport to 2.3 Closing issue fixed in released version.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
It has a lot more detail on this subject in section 4.4