How can I serialize a JavaMail Message?

John Zukowski

You can't. As messages are associated with folders which are associated with sessions, Message objects are considered not serializable. Like threads and images you need to save the pieces that are not session-specific and regenerate the object at the other end. Save the contents to an RFC 822 formatted stream (message.writeTo()), serialize the bytes, and recreate the message at the other end.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact