In order to use a Protonmail account with an app like Geary that uses IMAP and SMTP, you need to use the Protonmail Bridge application. This is not a problem on your x86 desktop, however on an ARM64 device like the Pinephone, there is no Protonmail Bridge binary available. Instead, we will be using a third-party open-source bridge application called Hydroxide. In order to use it, we will have to compile it on the Pinephone and configure it via the command line.

I will be using the protonmail account [email protected] which also has the username 1234test4321. If you have multiple emails associated with your account, pay close attention to when you are entering your username vs when you are entering one of your email addresses during configuration.

The first thing we have to do is install golang (make sure you have git too) in order to compile Hydroxide:
sudo apt install golang git

Now we download Hydroxide, compile it, and install it:
git clone https://github.com/emersion/hydroxide.git
cd hydroxide
GO111MODULE=on go build ./cmd/hydroxide

Now we have an executable called hydroxide (in green) in our directory ~/hydroxide/.

We’re going to move this into a bin directory so we can execute it as a command:
sudo cp hydroxide /usr/local/bin/

Now if you run hydroxide in the terminal, you should get a list of commands you can use with it. It is successfully installed.

The first thing we are going to do is log into our protonmail account. You can use your username (1234test4321) or any email address that is a part of your account, just keep it consistent. Typing in the following command will prompt you for your protonmail password.
hydroxide auth 1234test4321

Once you have logged in, you should be presented with a bridge password:

Make sure you save this password, because you will not have access to it again. I am on my desktop SSH’d into my phone, so the easiest thing for me to do is just copy the code to my clipboard and paste it into this command:
echo 'torYoN3eX0F1YPAnAv2N2UuQxK4RWKAov7XnPU4qtXI=' > ~/bridge-pass.txt

If you’re on your phone, however, you could just save it directly to a file with the following command. Note, however, that you will not see a prompt to type in your password. Just wait a second, type in the password, hit enter, and the output (including your bridge password) will be stored in a file:
hydroxide auth 1234test4321 > ~/bridge-pass.txt

Once we have the bridge password, we can start the hydroxide server and connect to it in Geary. First, run:
hydroxide serve

You should see this output:

Now we are going to open up ~/bridge-pass.txt in Text Editor and copy the bridge password into the clipboard (I use ctrl+a and ctrl+c with the terminal keyboard):

Then we open up Geary, navigate to “Accounts” and select “Other email providers” Fill out the fields as shown below, using the username you signed into the bridge with for “Login name” and the bridge password you just copied for “Password”:

Tap “Create” and don’t be alarmed when it fails the first time. You will also see some output on the “hydroxide serve” command we have running in the terminal. Now, there will be a new option called “Connection security.” Change the dropdown to “None” as shown here:

Tap “Create.” Yet again, it will fail, and you now have to change “Connection Security” to “None” under “Sending” as so:

Tap create, and the emails start coming in! You can see the activity in your terminal window now:

We’re not done yet, however. We need to run hydroxide as a daemon so that it will start with our pinephone and restart in the case of a crash, and also change some settings so we do not get errors in Geary.

Back to the terminal, hit ctrl+c to stop hydroxide. Now we are going to create a user service with systemd. Run the following command, and it will open a text editor (on my phone, vim opens. If you are unfamiliar with vim, hit i to insert text, hit escape when you’re done, type :wq and hit enter to save and exit):
systemctl edit --user --force --full hydroxide.service

The file we are editing defines the user service hydroxide.service. Paste in the following configuration, save, and exit:

[Unit]
Description = Hydroxide Protonmail Bridge

[Service]
Type = simple
ExecStart = hydroxide serve
Restart = on-failure

[Install]
WantedBy = default.target

Now start the service and enable it on startup:
systemctl start –user hydroxide.service
systemctl enable –user hydroxide.service

We can check that the service is running properly with systemctl status --user hydroxide.service:

The final step is to open Geary, tap the three lines icon at the top right, “Accounts”, then tap your protonmail account. Tap the “Server Settings” button at the bottom right. You will have to disable “Save draft email on server” and “Save sent email on server” like so (and then tap “Apply”):

Repeat this with each email that is a part of your account and you’re done! Restart your phone and make sure that the service has started up properly and that Geary can access it with no problems.

One final thing to note is that if you, like me, have multiple emails on your account, each inbox will receive all mail that comes to your account, regardless of which email it is sent to. This is annoying, however reading an email on one inbox marks it as read in every inbox, thankfully. You can also compose emails from individual accounts. Perhaps this will be fixed in future versions of hydroxide.

If you have any questions and suggestions, I would love to hear them! This is my first time writing up a how-to of this nature, and I tried to be as explicit as possible. If it’s too explicit, or some details were missed, please let me know.

Leave a Reply

Your email address will not be published. Required fields are marked *