This post explains how I used imapsync on Linux to successfully migrate all our user’s emails and includes a few tricks specific to Gmail and bulk transfers of multiple accounts.
Google Apps offers a great email service but if you want to move from an existing email provider then you may need some way of migrating existing emails into your new Gmail or Google Apps accounts. There are lots of tools out there to do this, and Google provide some excellent tools themselves for a wide variety of servers and clients including Microsoft Exchange and Outlook.
However, these tools aren’t always suitable. In our case we don’t have access to a Windows machine with sufficient bandwidth for running their IMAP tool, so we needed to find an alternative. I have previously used imapsync by Gilles Lamiral for moving between IMAP servers so naturally I turned to this option again.