Process Outlook PST Files via Open Source Java API

Read & Extract the content of Outlook PST files without using Microsoft Outlook via Free Java Library.

 

Java-libpst is Open Source Java library for reading and extracting contents of Outlook PST files. PST is a very popular file format used by MS Outlook for storing emails. It is used to store messages copies, attachments, calendar events, contacts, and other Outlook items. Java-libpst enables developers to access and extract all this information so that it may be migrated and used in other messaging systems.

With the release of the official PST specs by Microsoft, the library has been much improved with the passage of time. It now allows developers to handle very large PST files with reasonable speed, compressible encryption support, ANSI (32bit) support, Unicode (64bit) Outlook PST and Exchange OST Files support & much more.

Getting Started with Java-libpst

First of all, you need to install JDK 1.6 or higher.

Dependency that needs to be added to pom.xml file is,

Maven Dependency

<!-- https://mvnrepository.com/artifact/com.pff/java-libpst -->
<dependency>
    <groupId>com.pff</groupId>
    <artifactId>java-libpst</artifactId>
    <version>0.9.3</version>
</dependency>

Java API to Read Email from Outlook PST

Java-libpst enables Java developers to access & read email messages as well as attachments of an Outlook PST file. You need to provide the path of PST file from which you want to read email messages. The API allows you to go through the folders and emails inside the folders. You can easily display a specific email of your choice from the sever. The library also provides the functionality to get other email details, like email Subject, body, email body in Html format, recipient list, etc.

Read Email from PST - Java

// Open sample pst
PSTFile pstFile = new PSTFile("ample.pst");
// Get display name
System.out.println(pstFile.getMessageStore().getDisplayName());

// Read emails in folder
if (pstFile.getRootFolder().getContentCount() > 0) {
    PSTMessage email = (PSTMessage)pstFile.getRootFolder().getNextChild();
    while (email != null) {
        System.out.println("Email: "+email.getSubject());
        email = (PSTMessage)pstFile.getRootFolder().getNextChild();
    }

}

Extract Email Addresses from PST File in Java Apps

java-libpst API enables Java developers to extract email addresses and other details from PST files inside their own Java applications. Developers can easily go through every email and read the mail which is an attachment of an email.