Use Protonmail Bridge with Discourse

Problem: a) Protonmail Bridge cannot listen to IP other than, and b) Discourse in a Docker container cannot send SMTP requests to of the host machine.

Solution: We configure it to send to (the Docker’s bridge IP on the host machine), and then redirect to, on which the Protonmail Bridge is listening.

We do it with using Socat.

How To

Start by installing Socat:
apt install socat

We will run Socat as a service. Create service file:
nano /etc/systemd/system/protonsocat.service

… and put the following content in it:

Description=Socat Bridge ProtonMail/Discourse

ExecStart=socat -d -d -lm TCP4-LISTEN:1026,fork,reuseaddr,so-bindtodevice=docker0,range= TCP4:



  • We configured Socat to listen to all IPs, port 1026, and redirect the traffic to, where Protonmail Bridge is listening

  • Example from Socat documentation: <strong>socat</strong>

  • -d -d will print the fatal, error, warning, and notice messages; you may not want that much detail logged

Next, start the service:
systemctl start protonsocat

Check that it is running:
systemctl status protonsocat

And automatically get it to start on boot:
systemctl enable protonsocat

Done! Now, configure Discourse app.yml and rebuild:

  DISCOURSE_SMTP_USER_NAME: <SMTP username supplied by the Proton Bridge command-line application>
  DISCOURSE_SMTP_PASSWORD: "<SMTP password - put in quotes>"
  DISCOURSE_SMTP_DOMAIN: <the domain name>
  DISCOURSE_NOTIFICATION_EMAIL: <here, put the address form which Discourse will send transactional emails>
1 Like

Hi @meglio
I cannot find protonbridge.service so I replaced it with protonmail.service
But seems there’s issue with the format After=protonbridge.service,docker.service