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.