Upload Outlook archive PST to IMAP server

At one point or another, you may have used Microsoft Outlook to send and receive emails and if you have ever saved an archive file, you know that it is not so easily convertible to other formats. In this post, I’m going to show you a painless and quick way to move all your emails from a PST file to an IMAP server preserving everything, including the date and time the emails were originally sent.

We need few awesome tools to get this job done. One is a utility called readpst which is part of libpst. We also need a slick tool called imap_upload.py. Both of them are free software. readpst lets you convert the PST format to mbox, and imap_upload.py — as the name suggests — lets you upload the mbox to an IMAP server. You should be able to install libpst using the package manager of your GNU/Linux distribution. For example, to install it in Fedora, you can do something like: sudo yum install libpst.

I am assuming you have a file named archive.pst in your home directory. I’m also assuming you have saved a copy of imap_upload.py in your home directory. This file is standalone. The following will achieve the PST to IMAP conversion:

cd ~
mkdir mbox
readpst -o mbox -r archive.pst
python imap_upload.py --gmail --user=someuser@gmail.com \
  --password=blahblah mbox/SomeFolder/Inbox/mbox

Few notes about the above commands. First, I’m assuming the IMAP server is that of gmail’s. You can run imap_upload.py with -h switch to see how you can set the server/port to point to your IMAP server of choice. Also note the last command line argument to imap_upload.py. It is the path to a file called mbox in one of the directories under the mbox directory in your home directory (gosh, lots of directories). You need to traverse the mbox directory to see what files you have there and upload them separately.

-b option of readpst avoids saving RTF format of the email as attachment. Instead, HTML version of the email is saved by default (if available in the PST file). For older versions of Outlook (probably older than 2010), HTML version of the email is not available. So you should avoid using -b option. For later versions of Outlook, it should be safe to use -b option. You can always find out if the HTML version is included by upload to IMAP server and opening one of the emails you know has formatting.