getmail is a utility for downloading email messages from POP3 and IMAP mail servers and storing them in a variety of formats.
getmail can be installed by running:
# apt-get install getmail4
getmail uses one configuration file per account. The file can be specified at runtime.
The basic structure is as follows:
[retriever] type = SimpleIMAPSSLRetriever server = <mailserver> username = <username> password = <password> mailboxes = ALL port = 993 [destination] type = Maildir path = /media/mark/backup/Mail/<account>/ [options] read_all = false
You cannot indent the parameters as it will cause a parse error.
Most options are self-explanatory, with the exception of read_all. Setting this to false only fetches new messages from the server (a delta). Otherwise, getmail will fetch all messages every time it is run, and will just end up making duplicates.
The path for the destination must exist and must contain 3 writeable subdirectories:
Run getmail with:
getmail -r /path/to/config/file
It might be useful to create a cron job to backup mail on a regular basis.