Having finally switched to gmail as my main email client, I searched for years for a way to load my years-worth of older emails into gmail, while maintaining dates and other meta-info (like sender).
The blogger at swampgas.com made a python script that does exactly what I was looking for, and it will actually work to transfer any mailbox using the traditional mbox format into an IMAP server.
Awesome-town! It takes a while to run, especially for large files, and there’s a bunch of log output (which is good). But I have a lot of old files, so I didn’t import them all at once. i also had to run the script multiple times on some files, because it would crap out on a particular message.
I found that I would forget exactly how to run the script, and where to put the files, etc etc etc. So I tweaked his code a bit, and decided to add some more command-line options as well.
download the Python code and sample config file here.
NOTE that this is not really for non-coders. You have to be able to run a Python (version 2.5 or better) script that has a number of modules installed and (obviously) internet access. There are some simple parameters in the config file, but there are a few things that are hard-coded as well that you might need/want to adjust as I did.
I’m not a pro Python coder, so it’s doubtful that I’ll be able to help debug problems.