Gmail has become for many the favorite e-mail account, being very comfortable, with plenty of space available and a web interface that can be used through various devices: smartphone, laptop or desktop. But I guess that all of you know already all the advantages of using these email accounts so that they are becoming very important for us … but have you ever thought about making a backup of these mails ?
Yes Google is certainly very capable and reliable, but in the end, you do not have activate a free account with few thing assured ?
And it can happen to delete by mistake from the web interface one or more emails, even in these cases perhaps a backup can save us.
Thus we’ll see three ways to do a backup on your personal computer of all mail in a Gmail account.
1 Use Thunderbird to make a local copy
I use thunderbird as email client because with it i can check my 4 email accounts (not all from Gmail) and so in the past i set up this program to check also my gmail account instead of using the web interface from the browser. But i did a big mistake (from the backup point of view), i used Thunderbird wizard to setup the account and so i set up an Imap account, that means (in short) that if i delete something by mistake on the web the change is reflected also on my PC, also if i’ve already downloaded that message.
So today i’ve switched from imap to pop to do this simply (or to activate a pop account on thunderbird from zero):
0) Log in into your gmail account on the web click on settings in the top right corner, Click on the Forwarding and Pop linktab, Click on Enable Pop for all mail.
Also Click on step number 2 of that window and click on Keep Gmail’s copy in the inbox from the drop down menu, we want to keep a copy of the email on Gmail for our other devices.
1) If you have one delete your imap account on thunderbird, before doing this check the configurations and the sent email folder (i had something in local).
2) Now in Thunderbird go in Edit -> Account setting and click on Add Mail Account, the thunderbird wizard will ask your name, email address and password and will present to you something a window like the one in the screenshot.
So you can see that Thunderbird queries the Gmail server and automatically configures the appropriate IMAP connection settings for your account, but we want POP, so click on Edit, and change the parameters in:
- Incoming: change to “pop.gmail.com”
- Protocol (the drop-down list to the right of the Incoming field): change to “POP”
- Port (the field to the right of the protocol drop-down list): change to “995”
See also the official google guide at: http://mail.google.com/support/bin/answer.py?answer=180193
So now you are done, when you get the messages from that Thunderbird you’ll save a copy on that PC, leaving the messages also on the server available to others device that can still read them. A perfect solution of backup on your main PC.
2 Use Fetchmail to make a local copy
Perhaps you are fine with the web interface, or you dislike Thunderbird..or for any reason don’t want another Email client to do a simple backup, so here is another simple idea, use fetchmail and dump the content of your Gmail account into a directory of your PC.
But let’s see how to do that in Linux.
1) install fetchmail, i expect any distribution to have it so just use your favourite package manager to install it from your distribution repository (I.E aptitude install fetchmail, emerge fetchmail, yum install fetchmail).
2) in your home directory create a new .fetchmailrc file and then, add the following text into it:
#set daemon 600 poll pop.gmail.com with proto POP3 user '[email protected]' there with password 'xxxxxxxx' is youruid here options keep ssl
Substitute [email protected] and xxxxxxxx with your username and password of Gmail and youruid with your username on Linux.
Change the permission of the file with a
chmod 600 .fetchmailrc
and test the configuration with
This will start fetchmail in verbose mode, if all works fine you should find your email in /var/spool/mail/youruidwith and have message like this on your terminal:
fetchmail: 6.3.17 querying pop.gmail.com (protocol POP3) at Thu 24 Mar 2011 05:36:02 PM CET: poll started Trying to connect to 18.104.22.168/995...connected. fetchmail: Server certificate: fetchmail: Issuer Organization: Google Inc fetchmail: Issuer CommonName: Google Internet Authority fetchmail: Subject CommonName: pop.gmail.com fetchmail: pop.gmail.com key fingerprint: 6B:C4:63:05:87:1E:72:88:ED:81:C5:A2:51:6B:B7:B6 fetchmail: POP3< +OK Gpop ready for requests from 22.214.171.124 v14pf247455eeh.26 fetchmail: POP3> CAPA fetchmail: POP3< +OK Capability list follows fetchmail: POP3< USER fetchmail: POP3< RESP-CODES fetchmail: POP3< EXPIRE 0 fetchmail: POP3< LOGIN-DELAY 300 fetchmail: POP3< TOP fetchmail: POP3< UIDL fetchmail: POP3< X-GOOGLE-VERHOEVEN fetchmail: POP3< X-GOOGLE-RICO fetchmail: POP3< . fetchmail: POP3> USER XXXXXX@gmail.com fetchmail: POP3< +OK send PASS fetchmail: POP3> PASS * fetchmail: POP3< +OK Welcome. fetchmail: POP3> STAT fetchmail: POP3< +OK 0 0 fetchmail: No mail for firstname.lastname@example.org at pop.gmail.com fetchmail: POP3> QUIT fetchmail: POP3< +OK Farewell. fetchmail: 6.3.17 querying pop.gmail.com (protocol POP3) at Thu 24 Mar 2011 05:36:03 PM CET: poll completed fetchmail: normal termination, status 1
Cron or Daemon
Now to automate the backup you have 2 choice, put a cron at that run fetchmail every X (every 15 minutes, 1 hours or 1 time at day) or you can uncomment the option
set daemon 600
in your .fecthmailrc file and configure your graphical environment to run /usr/bin/fetchmail (no options) at the start of your session, this will run fecthmail as Daemon and check for new mail every 600 seconds.
So with fetchmail you’ll have a backup ready if everything goes bad, to use it you’ll need a local email client and import the saved emails.
3 Use Gmail Backup
Gmail Backup it’s a freeware available for Linux and windows that does a local copy of your Imap Gmail account.
Thanks to David that pointed this problem in the comments:
The main branch of gmailbackup won’t work for you as it needs python 2.5 and you are likely to have python 2.6 so refer to the following forum comment:
Description from the site
This program is aimed to backup and restore of your GMail mailbox. You will need to activate the IMAP access to your mailbox, to do so, please open your GMail settings and under POP/IMAP tab activate this option.
The messages are stored in the local directory in files which names follow the format YYYYMMDD-hhmmss-nn.eml where YYYY is the year, MM the month number, DD is the day number, hh are hours, mm are minutes and ss are seconds when the e-mail was SENT. For the case there is more emails with the same timestamp there is the number nn which starts with value 1. Label assignment is stored in the file labels.txt which is the plain text file and it pairs the emails stored in the file described above with the assigned labels.
I’ve not tested this solution, the last update of the site is of 2 years ago, but the forum seem active.
To use it on Linux you’ll need the wxPython (http://wxpython.org)
[amazon_enhanced asin=”B004HO62HA” price=”All” background_color=”332610″ link_color=”FFFFFF” text_color=”D4CE99″ /]