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:[EMAIL PROTECTED]] > 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:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
