I wanted to be able to store all of my ProtonMail emails locally for archival purposes, with the intention of running a local content search whenever I needed something retrieving.
I’m going to talk through my steps. There’s plenty of tutorials out there for email services such as; Gmail, Hotmail etc. But not much around ProtonMail, especially using a headless instance.
ProtonMail Bridge is an open-source piece of software built by the Proton Team to create a dummy IMAP server locally, with a sole purpose of decrypting your emails locally to enable you to use a desktop email client such as ThunderBird.
ProtonMail Bridge is a paid feature though, with a minimum requirement of the ProtonMail Plus plan ($5/month). ProtonMail Bridge is not available on the ProtonMail Free plan.
We’re going to set up a Cron job on a headless Ubuntu instance to periodically pull down all our emails. This instance will be running ProtonMail Bridge and a tool named Offlineimap, which will be used to store all your emails in a plaintext, searchable format.
Step 1: Setting up your Linux server
You’ll need to either have an existing server instance or create one. I use a Proxmox instance running on a server in my loft.
Once you have the server set up, or have logged in. You’ll need to do some updates and run some prerequisite installs.
sudo apt-get update
sudo apt-get upgrade
Step 1: gpg and pass
To use ProtonMail Bridge, you need to first set up the dependencies. These dependencies are
pass (A password management system), which has a dependency of
gpg (A key management system).
GPG should be installed on your system as part of the
update and upgrade commands that you initially ran after provisioning your server. If it's not, you can install GPG by running the following command.
sudo apt-get install gpg