Easiest way is probably with IMAP.
If you don't know how to do imap scripting (and I don't), and you can't find a working script, then the simplest way I know is manually. Set up a desktop imap client. Set up logins to both machines, subscribe to all folders, and use the desktop imap client interface to move email. Slow, perhaps, depending on upload speed, and how much email you have, but it should work.
Jeff