One of my ongoing projects for the last year and a half has been figuring out how best to export my tens of thousands of old messages in Gmail, and import them into my MobileMe account.
At first, I tried what seemed to be the most straightforward approach: since IMAP allows you to interact with mailboxes in different accounts and on different servers as if they’re local, I added both accounts (MobileMe and Gmail) to Apple Mail and just dragged thousands of messages at once between folders. (Gmail labels are represented, in Mail.app, as folders.) This had a number of functional problems:
- The nature of Gmail labels makes it such that duplicate messages were an inevitability. I used Gmail solely for a number of years, and got in the habit of using labels as they’re “intended” to be used — meaning, assigning multiple labels to the same message based on contextual relevance. Attempting to apply that fundamentally good idea anywhere outside of Gmail results in chaos.
- The nature of Gmail’s threaded conversations creates a problem re: received and sent messages. Different mail clients handle Gmail’s threaded conversations and labels differently; based on my recollections from the last time I tried, Mail.app doesn’t include messages you send in the folder-label view, but instead only puts them in the Sent folder.
- Dragging and dropping several gigs of mail at once is a useful visual analogy, but it reduces too many complicated (and bandwidth-intensive) processes into one step. In order for a copy like that to work, mail has to (1) be saved from Gmail to my computer, (2) copied from the local copy of Gmail to the local copy of MobileMe, and (3) uploaded from the local copy of MobileMe to the server. Drag-and-drop, in Mail.app, seemed to copy batches of mail into a cache of some variety, and then upload those batches directly to MobileMe. The end result was an unreliable transfer — a lot of messages were missing.
After letting the project rest for a few months, I decided to try it again last night. There were a few steps:
- In the Gmail web interface, sort through all your relevant mail to ensure that it’s properly labeled. I could have transferred all my messages en masse, but since I value organization and only really want about half of my labels anyway, it was worth taking the time to label everything correctly. N.B. — This included, for me, labeling messages in Sent Mail; some of them were already labeled, since they were parts of conversations, but some messages I’d sent but hadn’t received threaded replies to were in Sent Mail unlabeled.
- Add your Gmail account into Mozilla Thunderbird, with the default settings.
- Click “All Mail” in the Thunderbird sidebar and let it “think” for a while. Thunderbird first downloads message headers and then, if it’s left idle for long enough, seems to actually download and index some of the messages themselves. The best way to ensure that it downloads everything in Gmail is to click “All Mail” and just wait for a while.
- Once Thunderbird is idle, click the little computer icon in the bottom left hand corner to set Thunderbird to Work Offline. It’ll prompt you about whether you want it to save your messages for offline use — you do! If you only want to save certain folders, you can go into the Work Offline preferences and uncheck the folders you don’t want saved, but for simplicity’s sake, I left everything selected and let my computer download overnight.
- In my case, Thunderbird seemed to get stuck on a particular label-folder a few times. I resolved this by quitting and reopening the app, and repeating the Work Offline process until it was offline and the app was idle (the cog in the top right corner stops spinning).
- After quitting Thunderbird, open Mail.app and select “Import Mailboxes” from the File menu. Select “Thunderbird.” Navigate to your Thunderbird profile folder (typically in ~/Library/Thunderbird/, where ~/ is your Home folder) and click Continue. Check only those label-folders that you want to import — leaving everything checked off yields double-imports. Click Continue again and let Mail.app think for a while. N.B. — Thunderbird puts your sent messages in the label-folder that the conversation is a part of, so you don’t need to worry about importing the Sent Mail mailbox.
- Once your imported mailboxes appear in the sidebar of Mail.app, navigate to the folder you want to copy to MobileMe, and, one folder at a time, move the contents to a folder listed under the name of your MobileMe account. I found that using the secondary-click “Copy To” option worked a little better than just drag-and-drop, which hung the app for some reason.
- The Mail Activity window can give you a good idea of the progress of the upload, which can take any amount of time depending on how much stuff you’re uploading. But, assuming it doesn’t stop or freeze entirely, your mail will all end up stored remotely in MobileMe.
There are, of course, some drawbacks to this method:
- Any unlabeled messages are excluded. If you import all your mail without labels from Thunderbird (using the /Gmail/[All Mail] mailbox that appears in the import window), this isn’t a problem, but if you choose to maintain your label structure, everything you want imported needs to have a label attached to it.
- Your sent messages (as part of conversations or on their own) are going to appear in a folder that, by MobileMe conventions, shouldn’t contain sent messages. This doesn’t pose any kind of problem for viewing or searching your mail, and I find that it makes for a more intuitive mail-viewing experience, but it’s not technically “right.”
But, other than those two, this method has worked flawlessly for me. It’s circuitous, and I’m sure someone could find a better way to do it, but in terms of achieving the objective of moving messages from Gmail to MobileMe (or any other e-mail provider, for that matter), it works. And that’s what counts.