Neither of these tools are perfect for moving IMAP email to GMail, but they will work if nothing else is available. If you have a complex folder system for organizing your IMAP email, then either of these techniques are too labor intensive.
mozdev.org – mailredirect: index
The mailredirect extension for Mozilla Thunderbird (version 0.7 and above) and Mozilla Mail client adds ability to redirect one or more mails to one or more recipients.
Feature of mail redirecting is also known as bouncing.
Mark Lyon’s GMail Loader (GML) – Import Your Mail into GMail
Originally, the GMail Loader only worked with mBox format files (because it is all I needed) and was command line based. As others asked for similar functions, I began to expand it. Today, the GMail Loader is a graphical, cross-platform, Python based utility that supports two mBox formats (Netscape, Mozilla, Thunderbird, Most Other Clients), MailDir (Qmail, others), MMDF (Mutt), MH (NMH), and Babyl (Emacs RMAIL). Eventually, I plan to add support for direct sending of IMAP accounts, and am working on a library that can read and export Microsoft Outlook PST files. Until that time, try the ReadPST utility found on the “Other Utilities” page.