Export Your Gmail

Back up or export your Gmail messages to your computer for safe-keeping or offline reading.

You’re nicely settled in to your new Gmail account and may even have brought over all of your email Hack #74 since time began. You’re mailing up a storm, taking full advantage of the one gigabyte of storage space you’re allotted.

What, now, if you decide Gmail actually isn’t for you and you’d like to move out again, either to another Web mail service or back to the more traditional email application running on your computer? Or perhaps you just want a local archive of your Gmail for safe-keeping or offline trawling when you’re on a plane and desperately need a copy of that meeting report.

A nifty little archiving script packaged with the libgmail (http://libgmail.sourceforge.net) Python interface to Gmail Section 6.13[Hack #80 is just the ticket. It logs into your Gmail account for you, looks around, prompts you to select a collection of messages to archive, and downloads them to your laptop or desktop.

Installing the Hack

There’s really nothing to do beyond downloading (http://sourceforge.net/project/showfiles.php?group_id=113492, or click the Downloads link on the libgmail home page) and unstuffing the libgmail archive (http://libgmail.sourceforge.net).

Tip

The only requirement for libgmail is Python (http://www.python.org).

Running the Hack

Among libgmail’s demo applications is archive.py, a script that logs into Gmail, downloads your email messages, and saves them on your ...

Get Google Hacks, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.