A docker version of the Proton mail Bridge command line interface. It creates a local SMTP server, so other docker containers can send emails via your Proton email account.
!WARNING! As of the time of this writing, you need a paid plan (Mail Plus, Proton Unlimited or Proton for Business) to be able to log in. It won't work for free account.
(Merci Korben pour le logo)
Download the latest docker image from:
docker pull ghcr.io/videocurio/proton-mail-bridge:latest
(Alternative) Or the lightweight version based on Alpine Linux:
docker pull ghcr.io/videocurio/proton-mail-bridge-alpine:latest
(Optional) It is recommended to set up a custom docker network for all of your containers to use, for DNS / network-alias resolution:
sudo docker network create --subnet 172.20.0.0/16 network20
Launch it with the following command to expose TCP ports 12025 for SMTP and 12143 for IMAP on your local network interface.
You MUST provide a path volume storage (mkdir /path/to/your/volume/storage
).
docker run -d --name=protonmail_bridge -v /path/to/your/volume/storage:/root -p 127.0.0.1:12025:25/tcp -p 127.0.0.1:12143:143/tcp --network network20 --restart=unless-stopped ghcr.io/videocurio/proton-mail-bridge:latest
OR (docker compose version):
wget https://raw.githubusercontent.com/VideoCurio/ProtonMailBridgeDocker/master/compose.yaml
docker-compose up -d
(Optional) Make sure the container is running:
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d9932fb7136b ghcr.io/videocurio/proton-mail-bridge:latest "/app/entrypoint.sh" About a minute ago Up About a minute 127.0.0.1:12025->1025/tcp, 127.0.0.1:12143->1143/tcp protonmail_bridge
(Optional) You can check the bridge command line output with, you should see a bridge in ASCII art:
docker container logs protonmail_bridge
OR (docker compose version):
docker-compose logs
Now, you need to open a bash terminal on the current running container and use the Proton Bridge interactive command line:
docker exec -it protonmail_bridge /bin/bash
OR for the Alpine version:
docker exec -it protonmail_bridge_alpine /bin/bash
# First we need to kill the default bridge startup instance (only one instance of bridge can run at the same time)
root@8972584f86d4:/app# pkill bridge
# Login to your Proton account:
root@8972584f86d4:/app# /app/bridge --cli
....
Welcome to Proton Mail Bridge interactive shell
....
>>> info
No active accounts. Please add account to continue.
# Type help for a list of all commands:
>>> help
# Login to a Proton account (!MUST! be a paid plan to use this client), follow the instructions on screen:
# Tip: Use Ctrl+Shift+V to paste on most Linux terminal.
>>> login
Username: test_account@proton.me
Password:
Authenticating ...
Two factor code: 123456
Account test_account was added successfully.
>>> A sync has begun for test_account.
Sync (test_account): 1.0% (Elapsed: 0.5s, ETA: 46.0s)
...
Sync (test_account): 99.9% (Elapsed: 50.4s, ETA: 0.4s)
A sync has finished for test_account.
>>>
# Success !
IF you are using multiple domain names or email addresses, you SHOULD switch to split address mode (it will set credentials for each address in the account).
It will sync the account again, time to grab a coffee.
>>> change mode 0
Are you sure you want to change the mode for account test_account to split? yes/no: yes
Address mode for account test_account changed to split
>>> A sync has begun for test_account.
Sync (test_account): 1.0% (Elapsed: 0.3s, ETA: 32.6s)
...
Sync (test_account): 99.9% (Elapsed: 50.4s, ETA: 0.4s)
A sync has finished for test_account.
>>>
Use the following information to connect via an SMTP client. The port numbers for the SMTP/IMAP connections are 12025 and 12143 (see command docker ps
), NOT the one provided by the info
command.
You MUST copy the username AND password from the info command (the password is random and different from your Proton account):
>>> info
Configuration for test_account@proton.me
IMAP Settings
Address: 127.0.0.1
IMAP port: 1143
Username: test_account@proton.me
Password: abcedfGHI12345
Security: STARTTLS
SMTP Settings
Address: 127.0.0.1
SMTP port: 1025
Username: test_account@proton.me
Password: abcedfGHI12345
Security: STARTTLS
Configuration for another_account@proton.me
....
# Exit
>>> exit
root@8972584f86d4:/app# exit
See a list of all Proton bridge commands available here or use the help
command.
We have killed the default bridge instance by exiting it during the previous step, so we MUST restart the container:
docker container restart protonmail_bridge
OR (docker compose version):
docker-compose restart
(Optional) You can check the bridge command line output with:
docker container logs protonmail_bridge
It should end with A sync has finished for name_of_your_account
- Your email client might complain about the self-signed certificate used by Proton mail bridge server.
- If you want other docker containers to only be able to send emails, you should only expose SMTP port 25.
The docker image was tested on the latest stable version of TrueNAS Scale (at the time of writing), follow the installation custom app screen documentation.
The recommended parameters are:
- Container images - Image repository:
ghcr.io/videocurio/proton-mail-bridge
/ Image tag:latest
/ Image pull policy:Always pull...
- Container Entrypoint - Command:
/app/entrypoint.sh
- Container Environment Variables - Add > Environment Variable Name:
PROTON_BRIDGE_SMTP_PORT
/ Environment Variable Value:1026
- Port Forwarding - Add > Container Port:
25
/ Node Port:12025
(Or any other non-used port) / Protocol:TCP
- Storage - Volumes > Mount Path:
/root
/ Dataset name:protonmail
- Resource limits -
Check
Enable resource limits, configure the limits to your liking.
About point 3 of the recommended parameters, on Kubernetes (used by TrueNAS Scale for Applications) the Proton Mail Bridge applications seems to listening on localhost TCP port 1026 instead of port 1025. In order to confirm this setting, launch a console on your running Proton Mail bridge pod and see the results of a netstat -ltpn
command, you are looking for a bridge
program name on 127.0.0.1:1026
address.
If everything is set correctly, on a TrueNAS Scale console the following command:
sudo k3s kubectl get service --all-namespaces
should report the Proton bridge mail as:
ix-protonmail-bridge protonmail-bridge-ix-chart NodePort 172.17.22.33 <none> 25:12025/TCP 1h
The SMTP server is now available from TCP port 12025 on your server's LAN IP address.
- 2024/10/02: updated to Proton Mail Bridge v3.14.0
- 2024/09/13: updated to Proton Mail Bridge v3.13.0
- 2024/09/12: added a default compose yaml file for docker compose users.
- 2024/09/05: updated to Proton Mail Bridge v3.12.0, Alpine version: update to Golang 1.23
- 2024/04/30: updated to Proton Mail Bridge v3.11.0
- 2024/03/04: Initial public release, Proton Mail Bridge v3.9.1
Build / test docker image, see: Docker documentation
# Local tests:
docker pull golang:bookworm
git clone https://github.com/VideoCurio/ProtonMailBridgeDocker.git
cd /path/to/ProtonMailBridgeDocker/
docker build --tag=ghcr.io/videocurio/proton-mail-bridge .
docker images | grep proton-mail
docker run -it --rm --entrypoint /bin/bash ghcr.io/videocurio/proton-mail-bridge:latest
# (Optional) It is recommended to set up a custom docker network for all of your containers to use, for DNS / network-alias resolution:
sudo docker network create --subnet 172.20.0.0/16 network20
mkdir /path/to/your/volume/storage
docker run -d --name=protonmail_bridge -v /path/to/your/volume/storage:/root -p 127.0.0.1:14025:25/tcp -p 127.0.0.1:14143:143/tcp --network network20 --restart=unless-stopped ghcr.io/videocurio/proton-mail-bridge:latest
docker container logs protonmail_bridge
docker exec -it protonmail_bridge /bin/bash
>>> info
### TrueNAS
ping -c 4 protonmail-bridge-ix-chart.ix-protonmail-bridge.svc.cluster.local
nslookup protonmail-bridge-ix-chart.ix-protonmail-bridge.svc.cluster.local 172.17.0.10
There is a testing branch available if you want to submit a patch.
An Alpine Linux version for a small image base footprint is available in the Alpine directory.
Copyright (C) 2024 David BASTIEN
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
Made from Debian 12 (bookworm) Go image and latest Proton Mail Bridge sources