Inject Outlook PST Archives files into IMAP account

After searching for a LONG while for a method to inject my outlook pst files into my IMAP server without any success… I decided to write some scripts to do it myself. This is using a mix of libpst, perl, bash and some mbox2imap script found on the net…

Check the full article for details!

The aim:

I had a PST archive file coming from my Outlook work account and I wanted to make a backup of this file. Instead of having just only the file somewhere on my HDD, I wanted to inject the whole bunch of mail into my big IMAP account, where I keep every mail since years..

Moreover, as I have a lot of directories inside the PST, I wanted also the solution to keep this structure.


First of all, you will need to install libpst! For this one, I’ve stumbled upon at least three or four different version, each of them doing different things and supporting different outlook version. As I needed the lib to support Outlook 2003, I’ve chosen the 0.6 version. You can find download links at the end of this article. If the link is down for any reason, I’ve mirrored the source inside the pst2imap folder.

Just run the ./configure && make && sudo make install commands inside the source of libpst! Now you can move on to the exciting part!

Converting PST to mbox

Now that you have libpst, you can convert your pst file to mbox with directory structure:

mkdir out && readpst -r -o out/ archive.pst

You should now find inside out/ directory, the complete structure of your PST file. Just remove everything that is no more needed and that will not me converted to IMAP:

rm -rf Calendar Notes Tasks quarantine Sync\ Issues Outbox Journal Junk\ E-mail

Finally, gather the two files inside pst2imap directory below and open first file to setup your IMAP credentials. Then, edit to change the SOURCE and the BASEDEST variable. SOURCE variable should point to the directory inside your PST out/ folder where you have every subdir. BASEDEST will be the base folder inside your IMAP server where mails from your PST will be injected to. (this folder should not necessarly already exist, will create it in case of need.)

Now, just run the script !!

cd out/ && ./

And wait…


This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *