The Fetchmail program seemed like the best choice for this task. There are plenty of Googleable articles that describe how to get Fetchmail to work with Gmail. By default, Fetchmail uses the Mbox mailbox format.
I have experience as an email administrator. I have used Sendmail and Postfix SMTP servers. I have also used UW-IMAP and Cyrus IMAP servers. I have seen how different mailbox formats perform under various conditions. This lead me to shy away from the Mbox mailbox format. The Mbox format stores your entire mailbox in a single text file. Back in the older days of the internet, storing all 512kb of email in a single file was not that big of a deal. That format doesn't scale to the Gmail mailbox size, however.
I previously used the Maildir fomat before. Although not as efficent as the built in Cyrus IMAP mailbox, it is good enough. Below is my configuration for backing up Gmail onto my local server.
.fetchmailrc
poll pop.gmail.com
protocol pop3
username "myemail@gmail.com" password "mysecret"
keep ssl
mda "/usr/bin/procmail"
/etc/procmailrc
# Use maildir-style mailbox in user's home directory
#DEFAULT=$HOME/.maildir/
DEFAULT=/var/mail/maildir
/etc/crontab
0 2 * * * jeff fetchmail -d0 -k pop.gmail.com 2>/dev/null >/dev/null
0 2 * * * jeff fetchmail -d0 -k pop.gmail.com 2>/dev/null >/dev/null
With this configuration, fetchmail will download a fixed number of emails every day. As time goes on, eventually your entire inbox will get backed up. Also, new messages (that don't get deleted) will be backed up every night.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.