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.
- Log into gmail and go to “Settings”
- Make sure “IMAP” is turned on
- Install “getmail” (available for most flavors of linux, bsd and solaris)
- in your home directory create a “.getmail” folder
- in the “.getmail” folder create a file called getmailrc with the contents below
- setup your crontab. I am using the following
- enjoy the peace of mind that you can browse all of your gmail, even during the zombie apocolypse
type = SimpleIMAPSSLRetriever
server = imap.gmail.com
username = USERNAME@gmail.com
password = PASSWORD
port = 993
mailboxes = ('INBOX', '[Gmail]/All Mail')
type = Maildir
path = ~/Gmail/
0 3 * * * getmail --dont-delete -n
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
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?