adding insult to injury

Import Mail from Mac OS X into Gmail

Everyone who is migrating to Gmail loves the google search feature for all your new mail, but wouldn’t it be nice if you could get all of your old email messages into Gmail from your Mac OS X without forwarding the thousands of messages you’ve accumulated over the years by hand?

Mark Lyon wrote a great little PC program in python that automates importing your old email messages to your gmail account. The site instructions and the program are for Windows and work great, but what about us Mac users?

He was nice enough to include the python source code that also happens to work with Mac OS X, but for those of you that have no idea how to run python scripts, or don’t even know what python is and have no clue about mbox files, I’ve written a simple applescript that uses the terminal to automate the process for all of your mailboxes.

The script requires you to download Mark’s source code, modify a few settings and then click run to automate the process for all of your Mac OS X mailboxes, while allowing you to exclude other mailboxes.

1. Download Mark’s script to your Desktop. Instructions Here.
2. Download my gmlAutomator AppleScript.
3. Open the script in Script Editor.
4. Modify the properties at the top of the script
5. Run the AppleScript.

Another even more simple way to accomplish this was sent to me by Ken. The process is to create a new rule in with the action “redirect to
[email protected]”. Have it match whatever messages
you’re interested in bouncing up to gmail, for example all of
’em. Select the messages you’re interested in sending off and
run Message -> Apply Rules. Done!

If you leave the rule in, new (matching) messages will also get
bounced to gmail (and still preserved in

Kelly Friedman points out the following:

I finally got it to work (or at least it seems to be working right now, I’ll find out later).

First of all, you need the older version of the script, which doesn’t require Python Widgets. This can be downloaded here (choose the Linux version at the bottom):

www. marklyon .org /gmail /old /default.htm

Secondly, I use IMAP accounts, and the script doesn’t work with those. So what I did is created a folder “On my Computer” called “Gmail” and option-click-dragged all the e-mails from one folder into that mailbox.

Then, within the script, I set my path to:

property mymailboxpath : “/Users/ kerim /Library /Mail /Mailboxes/”

and I changed the following line:

else if eachMbox does not contain “.mbox” then


else if eachMbox does not contain “Gmail.mbox” then

That way it only works with this one folder.

I run the script. Delete all the messages, apply the appropriate Label to all the messages online in Gmail, and then I repeat the process with the next folder.

Hopefully it will work!