Tuesday, March 13, 2007

Adventures in Gmail Importing

Over the past few months I have been transitioning all of my subscriptions from my Yahoo webmail account to my Gmail account. It occurred to me that it would be nice to get the roughly 500 messages copied over to my Gmail as part of this migration.

I discovered an interesting technique for doing this which involves taking advantage of Gmail's support for checking POP accounts. Unfortunately, Yahoo discontinued free POP access a while back in an effort to force people to use their webmail interface to get more ad revenue. However, it seems that some industrious open source developers decided to write their own POP to Yahoo email gateways. I set up a program called MacFreePOPs, which is a POP server that uses the Yahoo webmail interface behind the scenes to access the data. After I set up Gmail to connect to my computer, it was a quick matter of importing the mail.

A day or two later it occurred to me that it would be a good idea to import my old mail which I don't have space for in my .Mac account into Gmail as well. I have emails dating back to 1994 when I first started college in Microsoft Entourage, which I used to use for mail before Apple's Mail.app. It was sort of a neat "blast from the past" to look through some of these old emails from family and friends as part of this process.

I have imported this mail into Gmail using the following technique, which unlike using Gmail Loader will properly show the original dates on the messages:

1) export email to mbox file (in Entourage, drag mailbox to desktop to do this; in Mail.app, select messages and Save As using Raw Message Source option)
2) convert to Unix line endings since Entourage saves using Mac line endings (using tr '\r' '\n' < infile > outfile)
3) copy to /var/mail/, which is where the ipop3d looks for mail (part of UW IMAP server package)
4) have Gmail log into the POP server on my computer to download the mail

There are a few caveats about this approach that I've run into so far:
- Gmail throttles the POP checking to roughly 200 messages per hour, so large imports take a while
- To get sent mail to show up properly under Sent Mail in Gmail, you must add the email address as an alternate from address in Gmail. It only seems to work if you are able to confirm the address (which was not possible for all of my many email accounts over the years)
- It's a good idea to label and archive the incoming Mail to keep your inbox from getting unwieldy.
- I've found a few really old emails that Gmail renders strangely (missing Date: header shows date Gmail fetched it, text only message shows as an attachment, some attachments don't load), but for the most part everything worked great