13
Backup your Gmail account with getmail in ubuntu 8.04 LTS
0 Comments | Posted by Edwin in General, Ubuntu
Recently we needed to have backups for old email accounts in our Google apps account. We needed to free up some space and a way to reference back to the emails in these accounts.
I’ve found various options with Thunderbird and Mac Mail. But all require to play with the off-line or sync features. Also I needed something that I could run from the backup server without moving 25GB of email from one computer to another. After couple queries in google, I found a good solution which was using getmail to retrieve emails from POP Gmail accounts.
So, here it is. Please remember to activate POP or IMAP feature in your Gmail account settings before start.
1. Install getmail
-
$ sudo apt-get install getmail4
2. Create a folder and file to store the emails
-
$ mkdir backup-emails
-
$ cd backup-emails
-
$ touch someuser-backup.mbox
3. Create getmail folder and config file and add settings
-
$ mkdir .getmail
-
-
$ cd .getmail
-
-
$ vi .getmail-gmail
-
-
[retriever]
-
type = SimpleIMAPSSLRetriever // Using IMAP here, if you want POP use: SimplePOP3SSLRetriever
-
server = imap.gmail.com //for POP use: pop.gmail.com
-
username = someuser@yourdomain.com // or someuser@gmail.com
-
password = yourpassword
-
[destination]
-
type = Mboxrd // (**)
-
path = backup-emails/someuser-backup.mbox // (**)
** Please check references links below for more info about other options.
4. start backup, sit back and relax
-
$ cd
-
$ getmail -d -r .getmail/getmail.gmail
I’m using -d here because I don’t need to keep those email account anymore. So you will need to remove it if you’re planning to continue using the account.
That’s all, add the command to a cronjob and you are all set.
References:
http://pyropus.ca/software/getmail/
http://blog.pengdeng.com/2008/03/backup-gmail-via-imap-using-getmail_16.html
http://www.mattcutts.com/blog/backup-gmail-in-linux-with-getmail/

