Got got to rave about this little python script from Remy.
Feed it your mail server imap details along with the folder you want to back up, it will then do two cool things:
1. Back up your email to a maildir so that you can restore it if you need to
2. Create an html repository of all the emails you backed up, including attachments