Hello Danny, I could never flame someone I learn a new english or saying at each mail from :-)
But yes I still don't understand why this happens even though:
1) yes, of course I invoke saveChanges() but it doesn't help me :-)
2) I tried doing the very same thing (manipulating a Javamail MimeMessage) outside the James framework just for testing and there I saw that every time I set the subject I can then immediately retrieve the changed version, why isn't that happening inside a service method of a mailet?
Any further help will be greatly appreciated because right now inside my mailets I need to dump the mail using writeTo() and then reparse that output in a new MimeMessage in order to see the effect of my changes to be propagated further down the rest of the service method and the following mailets in the pipe
thanks, ciao
ste
Danny Angus wrote:
Stefano,
I believe that the answer is that you have to call MimeMessage.saveChanges()
to "commit" changes to an existing message.
Please don't flame us if this seems to violate the "Principle of Least
Suprise" it comes from the JavaMail API, not the Mailet one.
d.
-----Original Message-----
From: Stefano Debenedetti [mailto:ste@;webaccess.mozquito.com]
Sent: 21 September 2002 20:37
To: James Users List
Subject: InternetHeaders mistery
Hello, I hope someone can save my sanity by helping me understand why a
very simple thing I'm trying to do inside a mailet's service method
doesn't work as I expect:
public void service(Mail mail)
throws MessagingException {
try {
MimeMessage mm = mail.getMessage();
String subject = mm.getSubject();
mm.setSubject(subject +"blabla");
subject = mm.getSubject();
.....
I would now expect the "subject" variable to contain the original
subject PLUS the added string but it's not: the second getSubject
invokation still returns the original subject instead of the modified one.
In addition, mailets following this one in the processor actually see
the modified subject and NOT the original one.
I don't get it, please help, thanks ciao
ste
p.s. I'm asking this 'cause I still don't get why this happens even
after I filled the Javamail's InternetHeaders class with debug prints.
I see the InternetHeaders.setHeader is called and that, at the end of
it, the subject header has been modified BUT the immediately following
InternetHeaders.getHeader call still sees the old one......
p.s.p.s. Of course I tried invoking saveChanges but that doesn't help
either (this is because it handles only the content of the mail and
content-related headers, at least from what I understood by looking at
Javamail sources).
--
To unsubscribe, e-mail:
<mailto:james-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:james-user-help@;jakarta.apache.org>
--
To unsubscribe, e-mail: <mailto:james-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:james-user-help@;jakarta.apache.org>
--
To unsubscribe, e-mail: <mailto:james-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:james-user-help@;jakarta.apache.org>