Backup emails with getmail


yum install getmail

Creating directory structure

$ mkdir ~/.getmail
$ touch ~/.getmail/getmailrc
$ chmod 700 ~/.getmail

Create where files will be backed up to

$ mkdir -p ~/mailbackup/mail
$ cd ~/mailbackup/mail
$ mkdir cur new tmp

 Config file


type = SimpleIMAPSSLRetriever
server =
username =
password = xx
port = 993
mailboxes = ALL

type = Maildir
path = ~/nrmartin/

# retrieve only new messages
# if set to true it will re-download ALL messages every time!
read_all = false

verbose = 2
message_log = ~/.getmail/nrmartinlog

mailboxes = ALL
# do not alter messages
delivered_to = false
received = false

Mutliple config fils

getmail --rcfile getmail1rc

getmail --rcfile getmail1rc --rcfile getmail2rc

A bash script: `


set -e cd /path/to/my-rc-directory rcfiles="" for file in rc-* ; do rcfiles="$rcfiles --rcfile $file" done exec /path/to/getmail $rcfiles $@ `

More info

See also