For those of you that are wondering how to get mail from your IMAP or POP3 accounts into Gmail, I found a great way to do it with Fetchmail. These are the options I used:
fetchmail --all --keep \
--smtphost gsmtp57.google.com,gsmtp171.google.com \
--smtpname email@example.com \
--protocol IMAP or POP3 \
--user yourmailserverusername \
Give this a try, it will prompt you for your IMAP password, then start copying away. BTW, the --keep flag tells it to keep all of your messages on your IMAP server, so it's not going to erase anything.
You may want to setup some Labels and Filters ahead of time on your GMail account so that you don't end up with 5000 messages in your inbox. For example messages that came from a domain name of my old employer get labelled with company name and archived automatically.
Messages will have all appropriate headers intact, however the timestamp that the messages are received will reflect the current time, rather than the original timestamp. There is no way around this because Google's SMTP servers automatically timestamp every incoming message.
There is no need to worry about MAIL FROM: headers being mangled like they would be if you forwarded them from a regular mail client. All MAIL FROM: headers will remain intact. Fetchmail only overwrites the RCPT TO: portion of the headers.
Let me know if you have any problems... Mine is currently chunking away on 850 out of 2867 messages... Gmail rocks!