Import Email To Gmail With Linux

My experience importing lots of old email into Gmail using Linux

Gmail Import

I spent ages trying to import my old mbox files (10,000+emails) into Google mail, and had no luck with clever tools like GML. GML started off working fine, but Google assumed I was a spammer and refused to play ball.

Here's how I did it.

I already had most of the tools installed and configured so this was easy-peasy.

Google Mail Import
  • I created a user on my linux box (Mandriva 2007 spring) for each of my mailboxes; E.g. ebay, sent-mail, amazon etc.
  • Using mutt, I bounced all mail from each mailbox to corresponding users on my system. (Use tag-all, then press 'b' to bounce). Using bounce instead of forward leaves the email in its initial state and shows it as coming from its original sender. I use postfix as my mailserver, and it chugged through all that lot without a hitch... apart from my binaries mailbox, which I had to do in blocks, otherwise errors got returned to my inbox.
  • In my new Gmail account, I created a label corresponding to each of my old mailboxes.
  • I opened port 110 on my box, and installed popa3d. I temporarily set up external mail accounts in Gmail (in settings, accounts) and let Google suck up all my email. When I set up the POP3 account in google, I set the default label to be the name of the old mailbox, so my old email will be stored with labels simulating my old mailboxes. I actually had to do this in stages, because I think Google only allows you to have 5 external email accounts.

Using this method, I managed to get ALL my 10,000+ emails into Google in just over a day. The reason it took so long is that Google received emails in blocks of 200, whenever it felt like it. I found that you can hurry it along a bit by editing the account and re-saving, prompting Google to grab the next block of 200.

Now, I have all my old mailboxes in Gmail, correctly stored into conversations, and even my sent-mail correctly showing as coming from ME. :-)

Hope this is of some use to you.