Export EML files to PST

Hi,

We have a Zimbra mail server hosted on Linux for our organization. We periodically archive the old messages (> 3 months) into a folder in EML format for restore if requested.

We are currently working on a requirement to let users request for a PST file with all the archived emails in a given period. Of course, we do not have outlook on the server. So when I stumbled into Aspose.email for Java, I was very excited. The system requirements mentions only Java, so I am assuming that there is no need for Outlook or an Exchange service (as most other solutions demand). Please let me know if this assumption is accurate.

Regards,
Ram

Hi Ram,

Thank you for your interest in Aspose.Email.

Your excitement is justified in the sense that you really don’t need to have Outlook or Exchange installed on your PC for creating and manipulating a PST file. Please download the latest version of Aspose.Email for Java 5.1.0 from our product download page and get started with the following sample code that adds EML messages to the PST.

Please note that there are certain evaluation limitations of the product that you can avoid by requesting a 30-day temporary license free of cost. We have a complete section for working with PST files that you can visit to get an idea of working with different areas of a PST file. In case of any confusion/inquiry, please feel free to contact us here.

Code:

//create the PST 
PersonalStorage pst = PersonalStorage.*create*("MyPstFile.pst", FileFormatVersion.*Unicode* );

//add a test folder to PST

FolderInfo fi = pst.getRootFolder().addSubFolder("Test");

//Load an EML from disc

MailMessage eml = MailMessage.*load*("a.eml", MailMessageLoadOptions.*getDefaultEml*());

//Convert this to MapiMessage

MapiMessage mapiMsg = MapiMessage.*fromMailMessage*(eml);

//add to the folder

fi.addMessage(mapiMsg);

//dispose the pst

pst.dispose();