You can just setup your account in for example OSX Mail, after synchronizing your messages will be in ~/Library/Mail (albeit not in a really nice folder structure like pure mbox or maildir, but you should be able to convert them without much hassle). Or you could use offlineimap (http://www.offlineimap.org), which gives you an IMAP dump/backup of your messages (in maildir format if I'm not mistaken). That said, the possibilities of getting your mail from IMAP are almost endless, just choose whatever suits you.
Btw, keeping 20000 mails just about anywhere might be convenient, but I really wonder what for (to clarify, I have maybe 300 mails right now on my own server and I regularly dump old stuff, while dumping for example registration mails right away due to security reasons)?
You can just setup your account in for example OSX Mail, after synchronizing your messages will be in ~/Library/Mail (albeit not in a really nice folder structure like pure mbox or maildir, but you should be able to convert them without much hassle). Or you could use offlineimap (http://www.offlineimap.org), which gives you an IMAP dump/backup of your messages (in maildir format if I'm not mistaken). That said, the possibilities of getting your mail from IMAP are almost endless, just choose whatever suits you.
Btw, keeping 20000 mails just about anywhere might be convenient, but I really wonder what for (to clarify, I have maybe 300 mails right now on my own server and I regularly dump old stuff, while dumping for example registration mails right away due to security reasons)?