GMail IMAP

Recently Google announced that all gmail users are getting IMAP, this is fantastic news. I won't actually use it with an IMAP client but I will use it to backup my mail and my meta data! It might even help me to slowly import years and years of old mail into GMail.

So how to do a backup, first you need imapsync or something similar, I'll use imapsync since that's what I know.

Second you need a local imap server to dump your gmail account into, I am using my current server that already has other mail in it so I made a sub-folder called GMail to sync into.

Once you have imapsync installed its pretty simple with the following command line:

imapsync --host1 imap.gmail.com --ssl1 --user1 you@gmail.com \
   --password1 secret --host2 your.imap.com --user2 you --password2 secret \
   --prefix2 INBOX.GMail. --authuser1 you@gmail.com --authmech1 LOGIN \
   --authmech2 LOGIN --syncinternaldates

You'll need to look at that command and set appropriate options for your user, password and imap account. Also if you're going to run this on a shared machine where other user accounts exist, you should use the --passfile1 and --passfile2 options to not show your password in the output of ps.

The process is slow, and creates some duplicates for instance you'll have a [Gmail]/All Mail folder that contains all your mail but you'll also have folders for each tag that would have copies of messages that are already in your All Mail. This to me is a small price to pay for the peace of mind that solid off-site backups provide as the thought of my mail on a 3rd party system has been keeping me awake :)

1 Comment

You can just use --exclude 'All Mail|Spam|Trash' and not get duplicates.

Leave a comment

Recent Entries

  • flashpolicyd 2.0

    I wrote a multi threaded server for Adobe Flash Policy requests, some background from Adobe:Since policy files were first introduced, Flash Player has recognized /crossdomain.xml...

  • Adventures with Ruby

    Some more about my continuing experiences with ruby, in my last post I saidthe language does what you'd expect and as you'll see in my...

  • New programming language of choice - Ruby

    I have fallen out of love with Perl some time ago, I cannot point to one specific thing about it that put me off, I...

  • On working from home

    I've not been posting much here, work has been incredibly manic the last while, especially I need to still finish off my SSO posts with...

  • Rework of puppet facts for /etc/facts.txt

    Previously I blogged a custom fact that reads /etc/facts.txt to build up some custom facts for use in Puppet manifests, well I've since learned a...

Close