Friday, December 24, 2010

Import from Outlook (pst) into Gmail

When I started my last job, one of the great perks I received is the ability to use the company exchange server to host my personal domain email.

So, shortly after I started, I re-targeted my MX records and setup my personal email address on my exchange mailbox.  Life was good, I had ActiveSync on my phone, and all my mail directed into a single bucket for reading.

Now, four years on, I resigned my post and started to un-tether my life from my job.

I bought some mail hosting from my ISP and re-targeted my MX records to point to them.  But I couldn't cope without mail sync between my PC and phone (neither could my wife).  So I asked my ISP if they offered Exchange hosting or IMAP access.....they did, but for a price.  A very hefty price.

After doing a bit of research, I decided to go back to my old gmail account, and have it POP mail from my ISP.  Life was good again, I had mail sync between my phone and PC via IMAP.

But now I wanted to bring all my old mail in from my existing company mailbox (personal mail only of course), so I exported out all of my personal email to a PST.  4GB later, I had it all bundled up in a pst file and went to look for a solution to import it into gmail.

a quick google later, and I came up with the "Google Email Uploader"  Went to the site and BAM, found out that the tool had been depreciated and there was a better tool called "Google Apps Migration for Microsoft Outlook".

Guess what kids, this tool is only for google apps subscribers.  What a shame.  All I wanted to go was get my mail into my FREE gmail account, doesn't google offer a tool for that?  Apparently not.

Further googling produced results for a few fan-made tools to import your mail from Outlook, but the solutions were not elegant, they simply setup a mini mail server on your PC and had gmail POP your mail in.  This produces one major problem, the mail is dated incorrectly.  The correct date shows up when you open the email, but when you look at it in a folder it shows up as the date it was popped from your PC.

Then I had a brainwave...what if I setup my gmail account in Outlook using IMAP and simply did a drag and drop to get my mail in. Although this solution worked, it was a bit flakey.  Even trying to grab 500 emails at a time to drag and drop in produced lengthy delays, and Outlook appeared to be not responding.  On top of that, the progress bar was not even close to a true representation of what was going on.

Sure, I could keep using this method, and eventually, I would have all my mail in, but I really wanted something that at least felt a bit more bullet proof, and gave me an idea of how the process was going.

I turned to Thunderbird.  Its management of IMAP accounts is far superior to Outlook.  So with my gmail account setup (using IMAP), I was all set to import....oh wait on a second....Thunderbird can't read PST files.

So now I needed to get my pst file into a format readable by Thunderbird, so that I could continue with my (not very well thought out) plan.  Time to ask the google again....

After a bit of searching, it seemed that the readpst fork of libpst would be the best way to achieve my goal.

So I downloaded the package.  Shortly after extraction, the following was heard from my office, "Oh noes....build from source!?!?!...but I am a windows guy.....I don't speak *nix....only cmd and ps"

Luckily, a kind gentleman called Nachum Kanovsky had already made this package for our convenience.

After grabbing the exe from Nachum, I followed a helpful comment on the bottom of that blog post and grabbed myself a copy of libiconv2.dll and regex2.dll (google them, they are pretty widely available), placed all three files into a directory along with my pst file, and opened a command prompt.  I ran "readpst -u myfile.pst" and voila!, my pst was converted to mbox format, and ready to be fed into Thunderbird.

So where to from here? I now needed to read my newly created mbox files into thunderbird.  I did this using the fantastic ImportExportTools.
(note, you cannot import mbox files directly into an IMAP mailbox on thunderbird, you need to create a local folder and import to there)

Once I had my mbox files imported into Thunderbird, I did a simple drag and drop into my gmail IMAP mailbox.  Guess what?  No freezing, and status along the whole trip.


So, the final solution I employed was this:

1) Download and install Thunderbird.

2) Setup your gmail account in Thunderbird.

3) Export your pst files to mbox format.  See above.

4) Import your mbox files into Thunderbird.  See above.

5) Drag and Drop your mail into your gmail IMAP account within thunderbird.

6) Sit back, enjoy a cold alcoholic beverage, and wait for the process to finish.


Merry christmas folks!

No comments:

Post a Comment