Saving a message object from JavaMail to the file system

A message class is not serializable, so you cannot save its object in a file. I tried to extract the important parts to call the constructor, but it depends on other classes that are not serializable. Is there another way?

+3
source share
1 answer

One option is to use the mbox local storage provider . Otherwise, you can use javax.mail.internet.MimeMessage.writeTo (OutputStream) to store the message in the file system and javax.mail.internet.MimeMessage (Session, InputStream) to create a message from the file system.

+1
source

All Articles