Quickie: Gmail Backups With Getmail

Audience: *nix users that want to backup their gmail

Today I have a real quick method of backing up your gmail email.

Call me paranoid, but no matter what it is, if it’s important to me I like to have more than one copy.

Gmail Setup

Your Setup


[retriever] type = SimpleIMAPSSLRetriever server = imap.gmail.com username = USERNAME@gmail.com password = PASSWORD port = 993 mailboxes = ('INBOX', '[Gmail]/All Mail')

[destination] type = Maildir path = ~/Gmail/


0 3 * * * getmail --dont-delete -n

Getmailrc Explained

mailboxes = ('INBOX', '[Gmail]/All Mail') - the mailboxes listed must be a tuple so you need to have more than one mailbox defined (otherwise it defaults to your INBOX).  ’INBOX’ is your inbox, ‘[Gmail]/All Mail’ is a virtual folder for every email in your gmail account

path = ~/Gmail/ - this sends your messages to a folder, other than ~/Mail/, so it doesn’t clutter up your regular system mail


Try getmail --verbose --dont-delete --all (probably within a screen) to download the initial batch of mail


Yep, there are probably plenty.  Right now it just dumps everything into one “folder”.  I don’t even know if there is a good way to sort these by folder (“label” in gmail-speak).  What do you think?


2010-01-21: Over at reddit.com someone recommended a post by Matt Cutts.  Thanks cpu_cyclist

If you liked this post, you can share it with your followers or follow me on Twitter!