i need to backup the emails contained in a PST file (outlook storage). i'm using libpst which is the only free library i found on the web ( http://code.google.com/p/java-libpst/ )
so i can access all the information in each single email (subject, body, sender ecc..), but i need to put them on a file
here someone said you can create an EML file from a "javax.mail.Message" object: Create a .eml (email) file in Java
the problem is: how do i create this Message object? i don't have a server or an email session, just the information contained in the email
p.s. creating a .msg file would be fine too
Here's the code to create a valid eml file with java mail api. works fine with thunderbird and probably other email clients:
You create a Message object the same way you would create one for sending, but instead of sending it you write it to a file. You don't need an email server. There's lots of examples of creating messages in the demo programs included with the JavaMail download, and in the JavaMail FAQ. See the Message.writeTo method to write the message to a file (Message is a Part, and writeTo is on Part).