Some email providers have IMAP import, where you just give them the password and they'll do it for you. Not the best solution in terms of security but might be ok if you're getting rid of your account anyway.
It gives you all of your mail in mbox format, which is a common format.