Bob Balaban's Blog


    Bob Balaban


    Backup your GMail account to NSF

    Bob Balaban  February 28 2011 11:15:14 AM
    Greetings, Geeks!

    I read with concern the recent reports of some GMail accounts disappearing, as I use a couple of them for business and other purposes. I thought about writing a program to download all my mail and store as backup in a Notes database, but then I remembered that Notes already has a built-in feature for doing that: IMAP integration.

    It took me 5 minutes to set it up and download over 7000 messages from my (thankfully still operating) GMail account. It even converted GMail "labels" into NSF folders.

    So, here's how you do it (I used Notes 8.52, I think it works in v7 as well):

    1) Go to your local Contacts database (ooops, I mean "Application"!), names.nsf
    2) Click on "Advanced" in the navigator, then "Accounts"
    3) Create a new Account document
    4) Name it anything ("gmail")
    5) "Account server" is "" (don't enter the quotes)
    6) Login is your GMail account name, including the part
    7) For Protocol I used  "IMAP online". I didn't experiment with the "IMAP offline" feature, but I suspect it adds your gmail mailbox to the replicator page for background sync. Maybe someone can confirm/deny
    8) I changed the SSL setting to "Enabled", because I have my GMail account set up to use SSL

    So far so good, Notes creates a new NSF for IMAP sync. When you open it, Notes goes out to the IMAP account and synchronizes. First time I tried it, though I got an error "Invalid SSL certificates".

    I fixed that problem by going back into the Account document, and going to the "Advanced" tab. I changed the "Send SSL certificates when asked" option to "Yes". I also changed "Accept SSL site certs" to "Yes", though I don't know if that's required or not.

    Works great! Thanks Notes!

    Geek ya later

    (Need expert application development architecture/coding help?  Want me to help you invent directory services based on RDBMS? Need some Cloud-fu or some web services? Contact me at: bbalaban,
    Follow me on Twitter @LooseleafLLC
    This article ┬ęCopyright 2011 by Looseleaf Software LLC, all rights reserved. You may link to this page, but may not copy without prior approval.


    1Erik Werfel  02/28/2011 3:58:25 PM  Backup your GMail account to NSF

    IMAP support is pretty cool, but if you're concerned about backing up the data, I think you'll want IMAP offline, and not online. With IMAP online, Notes is using IMAP in connected mode, and messages are pulled down only when you request them (by opening the message in Notes). I think you actually pulled down 7000 message stubs, and if GMail decided to zap your info, you'd be no better off (well, not much better off) than the rest of us. Using IMAP online saves space locally, and saves on download time because you leave most of the data on the server, but doesn't give you a backup.

    2David Clover  02/28/2011 5:54:59 PM  Backup your GMail account to NSF

    This is good and it works as described. It works but it's a bit clunky. It is very frustrating that whilst MS Outlook and Thunderbird (and indeed Windows Mail, Otlook Express and Mac Mail clients) allow you to collect email from multiple locations in the 'Mail Tree' all at one view, Notes forces you to create a completely separate mail database for each IMAP account. I like to drag and drop emails between different accounts sometimes - easy with Outlook and Thunderbird, but just not possible with the standard Notes client.

    3Keith Brooks  02/28/2011 7:35:05 PM  Backup your GMail account to NSF

    Bob, Yep been doing this for some time now. Your steps do require the SSL because that is how Google has it setup. They have pretty basic instructions on their site.

    David you are not totally correct.

    One can grab mail from anyplace into one mail file, BUT the IMAP does not play well with others so you could pull all your IMAP mail to one file.

    The problem is actually in the outbound email name and reply address. You can only pick one.

    Thus why one does it via location switching.

    4Daniel Schiavone  02/28/2011 8:38:20 PM  Backup your GMail account to NSF

    Been using IMAP Offline mode for years. In previous versions of Notes you could pull down mail from multiple IMAP accounts with one location. Hasn't worked this way for several versions. In 8.x and up you have to use a different location for each account. This isn't all that bad because you can use a different email address with each location. With locations you can access multiple accounts and use different email addresses from one mail interface.

    5Andreas Imnitzer  03/01/2011 2:32:29 AM  Backup your GMail account to NSF

    Obviously, you need to configure IMAP Online in the first place, before you can switch to IMAP Offline in order to create the database. Notes creates the DB in this step.

    And: Do not replace the ugly design with a Notes85Mail template, it will stop to work.

    I could not find the DB on the replication tab, but it replicates when using the Tools->Replicate menu entry.

    6Andreas Imnitzer  03/01/2011 2:51:17 AM  Backup your GMail account to NSF

    Hm, the GMAIL-NSF shows only headlines and loads the content when opening the document.

    When a Replication and sync starts, it syncs the Gmail-Account with my standard Notes E-Mail, which was not intended. Now I go and search how to stop this behaviour.

    7Bob Balaban  03/01/2011 5:15:25 AM  Backup your GMail account to NSF

    @eric - THANKS you are completely right about "online" vs. "offline". Unfortunately, I couldn't get it to work just by changing that 1 setting in the account document, not sure why. Had to delete the account documnet and re-create it.