A Python script for creating full backups of IMAP mailboxes with the following features:
ZERO dependencies.
Copies every single message from every single folder (or a subset of folders) in your IMAP server to your disk.
Does incremental copying (i.e., tries very hard to not copy messages twice).
Tries to do everything as safely as possible (only performs read operations on IMAP).
Generates mbox formatted files that can be imported into Mail.app (just choose “Other” on the import dialog).
Optionally compresses the result files on the fly (and can append to them). Only available in Python 2.x
Is completely and utterly free (distributed under the MIT license).
Runs on Python 2.x and 3.x with some limitations in newer Versions of Python.