Mac: A key benefit of using IMAP for your email is that everything is saved on the server, but one consequence is that it takes more effort to back up those emails locally. Horcrux is a Mac app that does it for your automatically on a schedule.
Horcrux supports iCloud, Gmail, Microsoft Exchange and a handful of other IMAP accounts. Once you're set up, Horcrux runs in the background and backs up your email on a schedule. It can also migrate your email to another IMAP server, and it supports multiple accounts. You can always back up your email manually, but Horcrux is handy since you don't actually have to think about it when it's running. It's a bit costly at $US14.99, but you can check out a free 30 day trial on the developer's site.