It has been a while since I have written a post on this blog. I recently got back into looking at how to backup my gmail accounts, just in case, because paranoia, you know…
As I thought I had seen back then, you cannot use Google takeout. I am unsure why exactly but the end result is that I needed a solution. There are a lot of defunct projects out there but an active one that is quite cool: GMVault.
Not only can this thing backup your mail on regular basis (note that if you use 2 factor auth, you will need to create an application password to allow gmvault to download all your mails), it can also export them to mbox/maildir.
You can of course take a look at the install guide for further details, i just went for the source install (using FreeBSD here) by doing:
tar xvf gmvault-1.8.1-beta python setup.py install
You can then start using the program straight away, to back your mail account up, just use:
gmvault sync --passwd emailaccount@gmail.com
Once this is finished, you can easily export this onto a Maildir account:
gmvault export -d location_of_your_gmvault-db -t maildir /where/to/export/
This worked well for me bar one issue, my dovecot/roundcube install decided not to see the folder, this fixed it:
for i in `ls -d */`; do mv $i .$i; done
I have donated money to this project because they are worth it, if gmail shutdowns for me tomorrow, i have a full backup of my mails on a server I own.