Google has a great built-in service to transfer your email to a new Gmail account, but it only works with Gmail. If you're taking your email somewhere else, tech blog Digital Inspiration created a script to make the transfer process easy.
Digital Inspiration uses a Google Script to accomplish the task. When it runs, it forwards all your email from your current Gmail account to your new address. It's not a perfect solution, but it's better than nothing. Head over to Digital Inspiration for the full guide.
Transfer your Gmail Messages to Another Email Address [Digital Inspiration]