I have a large IMAP email account which contains many emails in a rich structure of directories. How to back up the whole IMAP account to my local computer? The requirements:
Automatically downloading these files. There are many directories, and copying-pasting emails will take too much time.
Keep the directory structures which are used to organize these emails.
offlineimap to synchronize the emails when the iMail at HKUST change to @Connect.
On Fedora, installing
# yum install offlineimap.
The configuration in my
[general] accounts = USTiMail [Account USTiMail] localrepository = Local remoterepository = Remote [Repository Local] type = Maildir localfolders = ~/Mail/USTiMail [Repository Remote] type = IMAP readonly = true remotehost = imap.ust.hk remoteuser = zma
To start the backing up, simply run
offlineimap and it will ask for the password.
readonly = true in the Remote repository part is to make sure changes at local by accident are not synced to the remote IMAP side.
After the emails are sync’ed from the IMAP server, archive or compress as you need.
The emails are organized in the Maildir format. Many tools can be used to view the emails. I use
mutt -f /path/to/a/mail/dir/