Since Kayhan asked, I finally got around to finishing up my script to backup the mail in a gmail account to a local files.
The only requirement this has (besides python and a gmail account of course) is libgmail.
This is in keeping with the theme from my blogger backup that no matter how much I like or trust a company, the only backups I really trust are my own.
First a disclaimer, then a few notes about the script. I cannot stress enough that I take no responsibility for how Google will take you using this to access your account. It waits 10 seconds between each folder for safety, although that can be changes. That being said, I used this a ton of times on my email account while testing today and haven’t noticed any problems. And I know other people do much worse with their accounts. But still, use some common sense and be careful (although I’m not sure what that means in this case).
Now, on to more interesting stuff. This script downloads each label (including inbox, spam, starred, and all) and saves each one as a separate mbox file. Although the ‘all’ label is redundant for the most part, it is necessary to catch any unlabelled mail. The mbox files should be readable by most mail programs, but the have only been tested with pine, mutt, and BSD mail (the standard mail command). These actually seem a bit pickier than the documentation on mbox seemed to imply. Currently, all mail is listed as new, but I hope to fix that in the next release. Incremental backups are not possible at the moment, but I think if I play around with the message ids that may be possible.
Unlike some other things I’ve done, I do actually plan on updating this in the near future. libgmail can access gmail contacts too, so I may even decide to grab that info as well.
2 Comments
Sweet. I’m looking forward to trying it out.
You write very well.
Comments are closed.