ProtonMail recently released their Linux beta for Bridge, which provides IMAP/SMTP access to the service. Prior to Bridge you could only access the service through the web interface, which is sort of clunky and requires you to, among other things, rely on their search, which is limited by the fact that they can't really index your emails - because you're paying them not to read the message bodies!

ProtonMail provides instructions for setting up the Bridge with common email applications like Thunderbird, but that's about it. So here's how to set it up with NeoMutt and OfflineIMAP for fetching our emails.

(My full email setup also includes the common Mutt companions NotMuch for better searching and urlscan for viewing URLs more easily in emails, in addition to some custom scripts, such as one for viewing HTML emails in a nice popover window and one for viewing MHT/MHTML emails (which are emails that contain inline attachments). It's too much to cover here, but if you want to poke around these scripts and my full email configs (at time of writing), see my dippindots.)

Installing NeoMutt and OfflineIMAP

These instructions are for Ubuntu 16.04, but I imagine they aren't much different for other distributions (yours might even have a package you can install).

Install dependencies:

sudo apt install -y xsltproc libidn11-dev libsasl2-dev libnotmuch-dev --no-install-recommends

Then grab the latest NeoMutt release, extract, and build:

./configure --disable-doc --ssl --sasl --notmuch make sudo make install # so we can just access it via `mutt` sudo ln -s /usr/bin/neomutt /usr/bin/mutt

Then install OfflineIMAP:

sudo pip install offlineimap

Running the Bridge

The Bridge can be run from the command line with the Desktop-Bridge program. By default this opens a GUI to setup your accounts, but you can also access a console interface with Desktop-Bridge --cli .

If you aren't already logged in you need to run the login command in this interface.

Configuring OfflineIMAP

First thing to do is configure OfflineIMAP to access our ProtonMail emails.

OfflineIMAP looks for a config at ~/.offlineimaprc . My config at time of writing is:

[general] accounts = main [Account main] localrepository = main-local remoterepository = main-remote # full refresh, in min autorefresh = 0.2 # quick refreshs between each full refresh quick = 10 # update notmuch index after sync postsynchook = notmuch new [Repository main-local] type = Maildir localfolders = ~/.mail # delete remote mails that were deleted locally sync_deletes = yes [Repository main-remote] type = IMAP remoteport = 1143 remotehost = 127.0.0.1 remoteuser = <YOUR EMAIL> remotepass = <YOUR BRIDGE-SPECIFIC PASSWORD> keepalive = 60 holdconnectionopen = yes # delete local mails that were deleted on the remote server expunge = yes # sync only these folders folderfilter = lambda foldername: foldername in ['INBOX', 'Archive', 'Sent'] # is broken, but connecting locally to bridge so should be ok ssl = no

Basically this sets up an account arbitrarily called main which will store emails at ~/.mail in the Maildir format. It will only sync the INBOX , Archive , and Sent folders to/from ProtonMail (the folderfilter option). Emails deleted locally will also be deleted on ProtonMail (the sync_deletes option) and emails deleted on ProtonMail will be deleted locally (the expunge option).

After OfflineIMAP fetches new email, it will run the command defined for postsynchook , which in this case is is the notmuch command for updating its search index ( notmuch new ).

Important Bridge-related things to note:

Bridge generates a Bridge-specific password for you to use, so use that here and not your actual ProtonMail password.

Bridge's IMAP service runs at 127.0.0.1:1143 (normally IMAP runs on port 143 or 993 for SSL)

(normally IMAP runs on port or for SSL) Disable SSL because it was (at least when I set this up) not working with Bridge. But this seems like a non-issue because it's over a local connection anyways and the actual outgoing connection to ProtonMail is encrypted.

Then try running it using the offlineimap command.

Configuring NeoMutt

There is a lot to configure in NeoMutt, so I'll only cover what is necessary to get this setup working. If you're interested in seeing more, my NeoMutt config at time of writing is available here.

NeoMutt looks for a config at ~/.muttrc . To get it working with OfflineIMAP and to send emails with SMTP you need at least:

# "+" substitutes for `folder` set mbox_type=Maildir set folder=~/.mail/ set record=+Sent set postponed=+Drafts set trash=+Trash set mail_check=2 # seconds # smtp source ~/docs/keys/mail set smtp_url=smtp://$my_user:$my_pass@127.0.0.1:1025 set ssl_force_tls set ssl_starttls

Where my ~/docs/keys/mail file has contents in the format:

set my_user=<YOUR EMAIL> set my_pass=<YOUR BRIDGE-SPECIFIC PASSWORD>

Important Bridge-related notes:

The SMTP port is 1025 (typically it's 587 )

(typically it's ) See the previous note on Bridge-specific password

That should be all you need.

"Daemonizing" the Bridge

There currently is no way to daemonize the Bridge, but here's a workaround using tmux :

tmux new-session -d -s mail 'Desktop-Bridge --cli'