Maybe the behaviour you experienced with James 2.2 was a bug.
I think what you want to do is to change the sender of the Mail object.
Either you cast the Mail to MailImpl to call setSender or *better* you clone the message using new MailImpl(newName, newSender, oldMailObject.getRecipients(), oldMailObject.getMessage()); (it is highly recommended to create a new mailimpl (with a new name) when you change the sender (reverse-path) of an envelope.

As per RFC2821:
-  a gateway from elsewhere->SMTP SHOULD delete any return-path
   header present in the message, and either copy that information to
   the SMTP envelope or combine it with information present in the
   envelope of the other transport system to construct the reverse
   path argument to the MAIL command in the SMTP envelope.

The remotedelivery can be considered a gateway from elsewhere->SMTP so it is correct that it loose your custom return-path in favor of the sender of the Mail object you are sending.

Stefano

Steven Azueta ha scritto:
Greetings,

With James-2.2/JavaMail-1.3, I was able to set the Return-Path header
in my custom mailet and it would stick. (Using
java.mail.internet.MimeMessage.setHeader("Return-Path",
"[EMAIL PROTECTED]"), I would set it to a value that is different from
Sender and From.)

I've upgraded to James-2.3/JavaMail-1.4 and that no longer works.
After setting the return-path like so...

mimeMessage.setHeader(RFC2822Headers.RETURN_PATH,
MimeUtility.encodeText(customAddressString));

...a header dump of the message clearly shows that it has been
modified correctly.  However, when it gets sent, the return-path was
set to whatever the Sender (or From?) address was.  I've tried
MimeMessage.addHeader(), and that doesn't work either.

Looking through the james-2.3 code I see several spots where there's
custom treatment of the Return-Path header, and the james code mucks
with it, but I haven't found exactly where it gets changed from my
custom value to Sender.

Has anyone found a way to force a setting of Return-Path in a custom
mailet?  I don't see it listed as a bug, or listed as an intentionally
change after james-2.2.  Any clues would be greatly appreciated.

Thanks.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to