Make a Local Backup Of Your Gmail Account
From Wired How-To Wiki
Web-based e-mail services like Gmail, Yahoo Mail or Windows Live
Mail are great for their access-anywhere capabilities. The ease and
simplicity of checking your mail in a browser have caused many of us to
ditch the desktop client in favor of a web-based interface. It's one
less application to have running and, in the case of
Google's Gmail, the search capabilities and conversation threading blow desktop apps out of the water.
However, using a service like Gmail means you don't have a local
backup of your e-mail like you would if you were using a desktop
client. That means if there is a glitch on Google's side, like the one
February 28 that led to the
deletion of approximately 40,000 Gmail accounts, you could lose everything and be forced to start from scratch.
(Update 3/11 3:00 p.m. EST: A Google spokesperson emailed
Wired.com to say that no email was permanently lost, and the company
has restored 100% of the data,
per the incident report (pdf).)
Fear not— just because you prefer to use Gmail for the
day-to-day, it doesn't mean you can't store backups of your e-mail on
your local machine. It requires a bit of work to set up, but once you
do, you'll be able to enjoy the goodness of Gmail's web interface
worry-free.
This article is part of a wiki anyone can edit. If you back up your hard drive more often than you get your hair cut, please log in and contribute.
Other pages in this series need your help:
Backup Gmail Using a Desktop Client
All the major operating systems ship with a built in e-mail client.
Some are better than others, but all of them can connect to your Gmail
account and download your messages to create a local copy of your
mailbox.
Beware that some of these apps may store mail in funky
proprietary formats (Apple Mail, Outlook, we're looking at you here)
rather than industry standard formats like .mbox. To guarantee cross
platform compatibility, we recommend the
Mozilla Thunderbird client. Thunderbird 2.0 even offers a handy one-click set up for accessing Gmail.
First, you'll need to futz with Gmail's settings.
Set Up Gmail & Thunderbird
The unofficial logo of your latest desktop hack
Step 1. Go to the Gmail web interface and click the Settings
link at the top right corner of the page. Look for the "Forwarding and
POP/IMAP" tab and click the link.
Step 2. Now you need to enable either POP or IMAP. For
most people, POP will work just fine and it's the simpler of the two.
Just select the "Enable POP for all mail" option. You'll also notice
that you can control what Gmail does when your desktop client connects
under the "When messages are accessed with POP" setting. Choose "keep
Gmail's copy in the Inbox" since we're just using POP for backup
purposes.
Step 3. Now startup Thunderbird, enter your username
(the bit before @gmail.com in your e-mail address) and Google password.
Thunderbird will begin downloading your e-mail, creating a local
backup. There's no need to mess with Thunderbird's settings or since
you're just doing this for backup purposes.
Tip: Remember to open Thunderbird periodically so that your mail gets backed up.
Tip: Make a backup of your Google Calender as well using the
two-way sync add-on for Mozilla Sunbird.
Tip: Make Thunderbird look like a native Apple app by installing REO-2007's
Leopard Mail skin.
While this method will work and is definitely the easiest for
most people, there are some drawbacks. The most obvious is that the
backup doesn't include your sent mail. If you're looking for a way to
improve your backups and automate the process (and you don't mind a
little command line tinkering), read on.
The old Eudora 7 works great for this. I have just migrated it
to Vista and though it has some quirks it gives me access to all my
emails since 1999 with several ISP's. I use Gmail on the web from other
computers but work with my mail on Eudora. I am considering migrating
to Eudora 8 based on Thunderbird code but I have read some disturbing
reviews.
Backup Gmail Using Getmail
Getmail is an open source Python program that can backup your Gmail account.
Getmail will work on any *nix system, including OS X, and even Windows as long as you have
Cygwin installed.
Installing Getmail
Ubuntu users have it easy, since Getmail is in the Ubuntu repositories.
For other operating systems, you can either add the repository to aptitude or you can compile from the source like so:
Download Getmail, then open a terminal windows and type:
tar xzvf getmail*.tar.gz
cd [the directory it was unpacked into]
sudo python setup.py install
For Cygwin, you will probably first have to "rebase" your Cygwin
installation. Briefly, that means closing Cygwin, opening cmd.exe and
using it to run "dash" from C:\cygwin\bin, then typing "/bin/rebaseall"
at the prompt it gives you. More on that
here.
Setting Up Getmail
Now you just need a configuration file to tell Getmail how to connect to Gmail. There are a ton of
sample configuration files
on the Getmail site, but here's one that works well with Gmail. Create
a file at ~/.getmail/getmail.gmail and put the following text in it:
[retriever]
type = SimplePOP3SSLRetriever
server = pop.gmail.com
username = yourname@gmail.com
password = yourpassword
[destination]
type = Mboxrd
path = ~/gmail-archive/gmail-backup.mbox
[options]
verbose = 2
message_log = ~/.getmail/gmail.log
Getmail won't create the mbox file, so before we get started, create a new empty file called
gmail-archive.mbox
in the gmail-archive folder of your home directory (or where ever you
choose to store it). From the command line this will do the trick:
touch ~/gmail-archive/gmail-backup.mbox
Running Getmail
You have everything set up, so it's time to actually make the backup. Fire up a terminal window and enter the following line:
getmail -r ~/.getmail/getmail.gmail
You should see a long string of messages begin printing out as
Getmail starts grabbing the contents of your Gmail account. If the
script stops, fear not -- Google has some limits on how many messages
can be retrieved at one time. Just run the above command again the
Getmail will pick up where it left off. See
Getmail's documentation for more about this "cutoff" issue.
Now you have an mbox-formatted local backup of your Gmail
account and you can access it with any e-mail client that understands
mbox files, which is pretty much everything except Microsoft Outlook.
To automate this process, just create a shell script and attach
it to a cron job that runs once a day or however often you feel is
necessary.
Backup Using Fetchmail
Backing up using
Fetchmail
is probably the most difficult and arcane option of the bunch, but if
you're looking for a weekend project and enjoy tinkering with the
command line, Fetchmail can create backups of your Gmail account.
Have a read through the Fetchmail documentation to see how you need to set things up.
Also check out Lifehacker's excellent
tutorial on Fetchmail.
It's written for Windows users running Fetchmail under Cygwin, so if
you're on a *nix system just ignore the Cygwin-specific elements.
In the Future
Online sites businesses often depend on your eyeballs hitting their
web pages. So it would go without saying that making your data portable
doesn't seem to be in the best interests of the services you use
online. After all, how are these companies going to keep you coming
back?
However, the ethics of that business model is in question. In
order to make their sites compelling and competitive, services like
Gmail or Yahoo's mail service are allowing you to import and export
your data. Google has even formed a
Data Liberation task force
which aims to make all of your data on its sites portable. Its message
is clear: In the future, your contacts, your e-mail messages, your data
are yours to keep and use wherever you want to.
This page was last modified 20:44, 11 March 2011 by sam_gustin. Based on work by qwerty0, howto_admin, pstatz, mvip, brucemcintosh, hereandthereblog and flyingsolo.