One of the things I had been meaning to do for some time was to switch all of my email over to my Gmail account. The idea is simple: I have a lot of different email accounts, and it’d be great to keep them all in one place, backed up, and always accessible. So, setting up Gmail to access each of my different email accounts (well, five of the most important, and the rest just forward to my gmail address) was trivial. The hard part, however, was getting all my previous messages into Gmail.
Here’s a quick overview of how to get all of your old emails into Gmail as painlessly as possible (and one way that preserves dates!).
Loading Emails
I spent some time looking into the different options I had for loading my email messages into Gmail. I have about 10 thousand or so that I wanted to keep stored (there’s a lot more than that sitting around in various mbox files, but these were the important ones). These 10 thousand or so messages comprised about one year of using the Apple Mail application on my Mac. So, poking around, I found a Python script by Mark Lyon called GML (for GMail Loader), which was designed to iterate through each message in an mbox (or other format) file and forward each message to GMail.
I managed to get the script working (one tip: be sure to export your messages by using the Save Archive option, which will create appropriately formatted mbox files for the script to read) and was able to import about the first thousand or so messages I had. Unfortunately, I ran into a couple of problems. First, I could only forward so many messages an hour due to a restriction set by my ISP’s SMTP server. Second, and most problematic, was that the GML script would actually forward each message, one-by-one, as if I were clicking the Forward button in my email client. This meant that, although the message still had it’s original date associated with it, the message would show up as having been originally sent on the date that I forwarded the message, not when it was actually received. This was a problem, and there had to be another way.
One idea I had was to setup my own pop server, where I would place all of my archived messages, and setup this server as an account in Gmail. Then, Gmail would connect to my mail server and load all of my old messages. I never got a chance to try it, but my guess is that it would work. Instead, another idea came up (courtesy of Costa): use IMAP.
Not long ago, Google announced the Gmail service would now support IMAP, allowing mail clients to connect to Gmail and use it as a kind of clearinghouse for all things email (IMAP stores everything on the server, allowing any number of clients to connect and always appear in sync with one another). If I added Gmail as an IMAP account to my Apple Mail program, could I then simply drag messages stored in the various folders into Gmail? The answer, luckily, was yes!
It was simple: I merely added Gmail as an IMAP account to my Apple Mail client, then just dragged folder-by-folder all the messages important to me onto my Gmail account. It took a while to transfer all the messages (be sure to open the Activity window in Mail to see your progress), but once it was done, all my old messages were safely stored in Gmail and had their original dates! Perfect!
Using IMAP
So now I’ve got my desktop Mail client using Gmail as my sole email account, along with my iPhone. Whenever I read a message on my desktop, it’s marked as read on my phone. And whenever I send an email from my phone, it appears in my Sent folder on my desktop. Everything stays in sync, and I’m very pleased with how it turned out.
One note: be sure to check out this page for details on fine-tuning your Gmail IMAP setup with Apple Mail and the iPhone. There’s a couple of neat little tricks to get your setup streamlined.



