Home > Uncategorized > Smart backup for your GMail account

Smart backup for your GMail account

There are a number of solutions out there that allow you to back up your Google mail, but all of them have some significant shortcomings. That’s pretty surprising given the popularity of GMail. BaGoMa aims to address all (or most) of them.

  1. BaGoMa is a command line application, so you can easily automate the backup. A GUI might be added in the future if there’s enough of a demand for it.
  2. It runs on all major operating systems: Linux, Windows, Mac OS X, basically anything that Python runs on. For Windows users the zip file even contains a stand-alone executable that has the Python interpreter and libraries built-in, so you don’t need to install anything else.
  3. It is open sourced, and contributions from the community are welcomed and encouraged. That also means you can read the source code  yourself to make sure your password and emails remain private.
  4. It has no arbitrary limitations on the tag/label names you can use in Google. Some other solutions out there expect you to only use ASCII. That means non-English users are out of luck. It even auto-detects the main types of folders in use so that it can skip folders such as “Spam” and “Trash”.
  5. Most importantly, it is tuned to work specifically with Google mail. There are a lot of generic applications that are able to backup an IMAP account. GMail however is not a true IMAP account. For example, if you apply 5 tags/labels to an email message, it shows up in 5 different IMAP folders. From the perspective of a regular IMAP application those look like 5 distinct messages, so they get backed up 5 times. It’s not clear what would happen when you attempt to restore your mail from such a backup. Will you end up with 5 identical copies of the message, each with a single tag/label, or will you end up with a single message that has 5 tags? BaGoMa does the right thing. In this case that means the message only gets downloaded (and backed up) once, and when restored all the original tags are applied to the same message.

The use of BaGoMa is extremely simple. To back up your account all you need is:

bagoma --email=your_user_id@gmail.com

It works seamlessly with Google Apps for Business, so if you’re hosting your business email with Google you can use your business email address instead of YourUserId@gmail.com to back up your business account. Please note that if you don’t specify a backup directory, BaGoMa will use a directory that matches your email address. Email addresses are case insensitive, but on operating systems with case-sensitive file systems you need to be consistent in how you write your email address, or specify the backup directory.

To restore your email you would run:

bagoma --email=your_user_id@gmail.com --action=restore

So what are you waiting for? Give it a try and stop worrying about forgetting your password and getting locked out of your account, or losing important emails if Google ever has an E-Mail outage.

BaGoMa homepage: http://sourceforge.net/p/bagoma/

BaGoMa downloads: http://sourceforge.net/projects/bagoma/files/

BaGoMa documentation: http://bagoma.sourceforge.net/

Categories: Uncategorized Tags: , , , ,
  1. s0sha
    June 1st, 2012 at 15:45 | #1

    Hi

    I get this error when trying to connect. Any idea how to resolve it?

    server@server.com [~/BaGoMa-1.10]# python bagoma.py --email=my_email@gmail.com --log=DEBUG
    DEBUG    **** **** **** **** **** **** **** **** **** **** **** ****
    DEBUG    Version: 1.10
    DEBUG    [('dryRun', False),
     ('logLevel', 'DEBUG'),
     ('server', 'imap.gmail.com'),
     ('port', 993),
     ('version', False),
     ('cacheDir', None),
     ('action', 'backup'),
     ('logFile', 'log.txt'),
     ('email', 'my_email@gmail.com')]
    Password:
    INFO     Connecting to imap.gmail.com ...
    Traceback (most recent call last):
      File "bagoma.py", line 936, in <module>
        sys.exit(main())
      File "bagoma.py", line 903, in main
        server = ImapServer(options.server, options.port, options.email, options.pwd)
      File "bagoma.py", line 104, in __init__
        imaplib.IMAP4_SSL.__init__(self, serverAddr, serverPort)
      File "/usr/lib64/python2.6/imaplib.py", line 1138, in __init__
        IMAP4.__init__(self, host, port)
      File "/usr/lib64/python2.6/imaplib.py", line 163, in __init__
        self.open(host, port)
      File "/usr/lib64/python2.6/imaplib.py", line 1149, in open
        self.sock = socket.create_connection((host, port))
      File "/usr/lib64/python2.6/socket.py", line 567, in create_connection
        raise error, msg
    socket.error: [Errno 110] Connection timed out 
  2. Gabriel Burca
    July 5th, 2012 at 21:32 | #2

    @s0sha

    Do you think you might have hit the download limit imposed by Google?

  3. July 16th, 2012 at 16:09 | #3

    I just wanted to quickly say thank you for creating such a wonderful little Python app. I now have it installed on my NAS box, set to auto-backup my Gmail every evening. I sleep a little bit better as a result. Many thanks!

    • Gabriel Burca
      July 16th, 2012 at 22:13 | #4

      Thank you. I’m glad other people find it useful. It gives me an incentive to update it.

  1. April 6th, 2016 at 11:43 | #1