gmail backup

December 23rd, 2009

Over the last years I accumulated quiet a bit of mail in Gmail. It works, and I find it very inspiring to see its features grow while I keep all my data. But I also grew worried: What would happen if my mail should go away? I have paid google exactly zero for keeping all my email. There would be nothing I could do.

Turns out that it is possible to make a copy. Googles own Matt Cutts described it well

I found that these getmail parameters worked well for me:


[retriever]
type = SimpleIMAPSSLRetriever
server = imap.gmail.com
username = EMAIL@gmail.com
password = PASSWORD
mailboxes = ("[Gmail]/All Mail",)

[destination]
user = getmail
type = Maildir
path = /root/.getmail/

[options]
read_all = false
verbose = 2
received = true
delivered_to = true
message_log = /root/.getmail/gmail.log

It took a while. Actually days. It seems that you only get mail out at a slow data rate. Then there is a bandwidth limit. getmail failed after a while with:


getmailOperationError error (IMAP error ([ALERT] Account exceeded bandwidth limits. (Failure)))

Just waiting a couple of hours took care of this. Having had the mail not backed up for 5 years it was quiet alright to wait 5 hours.

Another error occured with 5 mails. Getmail for instance would end with:


getmailOperationError error (IMAP error (command FETCH ('3049', '(RFC822)') returned NO))

And it would do so repeatedly with the same number. I assumed that something had gone awry with those mails. After pretending that the mail already had been retrieved via the oldmail-imap file getmail soldiered on.

Tragically at some point my connection went away. I had downloaded around 120,000 mails during that session.
Getmail updates the oldmail-imap file only when done (or cancelled via ctrl-C). So the next time it started I went to download the same mails again.

Even with that glitch things worked out. And I feel pretty good about having a copy of my mail now.

Having a secure copy of your data is never a bad idea.

Only 99 decades left till 3000

December 19th, 2009

thank you sqlite

December 6th, 2009

Since more than 25 years I write computer programs. Writing some information to a file for later use is a very common thing. It worked (most of the time). But it never felt right. Common up with a format, creating a writer and a parser. All that can be done. Rather mundane. Finally I switched to using sqlite for this kind of thing. And this feel right. It works. And will just cover 99% of all cases were I have used “fopen” in the past. One of the things that I like about coding for a living is that it keeps getting better. Not me, that’s for sure, but the tools. And that almost makes up for the natural decline in raw brain power.