Even though Gmail has been proven quite reliable over the years, there have been isolated episodes of data loss. In any case, I backup my mail locally: better safe than sorry. On my Linux machine I use “getmail
” to download my mail through POP and store it in a single “mbox
” file. First of all, I enabled POP on my Gmail account: went into Gmail Settings, clicked the “Forwarding and POP/IMAP” tab, ticked “Enable POP for all mail“, and chose “When messages are accessed with POP keep Gmail’s copy in the Inbox”.
Then I installed getmail
, and prepared the environment. getmail
by default uses a “~/.getmail
” directory to work, and in particular it searches for a “~/.getmail/getmailrc
” file to read the configuration. So I created this file, together with an empty mbox
file that I will use to hold all my mail.
$ mkdir ~/.getmail $ touch ~/.getmail/gmail.mbox $ touch ~/.getmail/getmailrc
Then I edited the “~/.getmail/getmailrc
” to contain this information:
[retriever] type = SimplePOP3SSLRetriever server = pop.gmail.com username = "mymail"@gmail.com [destination] type = Mboxrd path = ~/.getmail/gmail.mbox
After this setup, I simply run “getmail
” from the command line, it asks for the Gmail password and retrieves all the mail it can through the POP protocol. I had to run it several times before it downloaded everything.
It is also possible to include a password in this file, but I don’t want to keep my Gmail password inside an unencrypted file. The downside is that every time I run getmail I have to insert my password. Since I update my backup once a week, that is not a big issue. By putting the password inside the configuration file it is also possible to run a “cron
” job such as “su username -c getmail
” that backups the mail by itself.
darkduck
2011/07/18
That’s easy to copy emails from GMail to local drive to save backup.
But how to restore?
Balau
2011/07/18
This “Backup Gmail” tool seems to do what you want, but using IMAP.
Nux
2011/07/18
No application that I have tried yet managed to fully backup my gmail account. I’m vendor locked-in!
Daniel Escasa
2011/07/28
@darkduck, restore where? The author has set up GMail POP to keep messages in the inbox, so nothing to restore, at least as I understand your question.
Jan Henkins
2011/08/01
Hello there,
Quick question: Why use the mbox standard? The problem with that is a matter of scalability, especially if you start filling it up with 10’s of thousands worth of GMail messages.
Balau
2011/08/01
The way I see it is that I backup my Gmail in case of catastrophic data loss. Without such a disaster, the mbox file will only be accessed by appending new messages, and it is easy to store everything in one file. Maybe someday I will do an unzip-getmail-zip script, but up to now disk space is not an issue. If I could get hold of some data that clearly shows that another format (do you have some other format in mind?) is better than mbox for what I need, then I could change destination type in “getmailrc” file and re-download everything.
Aashi
2011/08/04
Hello guys,
Here is a simple solution for backing up your mail through Beyond Inbox http://www.beyondinbox.com/ , which let you keep your email organized and inbox clean so that you can find a message when you need it. At the same time, you also need to make sure that you archive and backup your email to prevent the loss in situations like accidental loss of data from email servers, hacking of account, forget password, over size inbox or unpredictable scenarios.
There are five basic functions that we all need to perform in order to manage and safeguard our email- backup, restore, archive, transfer and organize the data. Beyond Inbox can help you perform all of these in a very efficient and easy way.
Using Beyond Inbox, you can backup, restore, archive, transfer or organize email from any IMAP enabled email account.
Beyond Inbox is available in two different flavors i.e. an easy User Interface and Command line interface.
You can use this tool on Windows, Linux as well as Mac OSX. Click here to download http://www.beyondinbox.com/beyondinbox-download.html
You can easily install beyond Inbox. See the link http://www.beyondinbox.com/documentation/mail-backup–how-
to-install-beyondinbox.html