Question

External SMPT installation/configureation

Good day! I know that Digital Ocean recommends to use external email services and I want to know how to do it properly. I want to know how to implement my proton account into my droplet - (Linux based server,Ubuntu 20.04) in order to get external SMTP server. I try to put SMTP credentials for CMS on the Linux server that I get from ProtonMailBridge on my computer (Windows 10) but it doesn’t work. I entered SMTP hostname (both 127.0.0.1 and mail.protonmail.ch), port, username, password) but got fsockopen(): unable to connect to … As far as I understand I need to install ProtonMailBridge on Linux server, then log in my account on this server, get SMTP credentials and then enter them on CMS as I truly get proton SMTP server on the Linux server. Could you explain me if my guess is right? Thanks in advance.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

KFSys
Site Moderator
Site Moderator badge
November 22, 2022
Accepted Answer

Hi @johnberg,

I’ve not actually used ProtonMail before however and it seems Sergio has already explained how to configure it. What I’ll say additionally, is to use an external Mail service, you’ll need to point your MX record to them, that would be the first and most important change to do.

Once your MX is pointed to them, you’ll be able to receive messages on their platform.

Thank you for all replies. This is instruction that I have made for this situation (you have to have paid Proton account AND have configured domain mail in your account). So these are my steps.

  1. Install gpg (sudo apt-get install gpg) - a utility for encrypting information and creating an EDS. We will create a key for the database of passwords by using it

  2. Create a gpg key with id ‘ProtonMail Bridge’ (gpg --batch --passphrase ‘’ --quick-gen-key ‘ProtonMail Bridge’ default default) without a password (with an empty passphrase) so that it can be used in the background (no need to pass the password then). If you want to see your key use this command - gpg --export -a “ProtonMail Bridge”

  3. Install pass (sudo apt-get install pass) - console password manager = simple database of passwords and logins

  4. Protect this db pass with gpg-key “ProtonMail Bridge” (pass init “ProtonMail Bridge”)

  5. Download ProtonMail Bridge (_wget https://proton.me/download/bridge/protonmail-bridge_2.4.8-1_amd64.deb_). the software version will change; to get the latest one go to the https://proton.me/mail/download tab. Open the developer mode in the browser (F12 / Explore the code, etc.), switch to the network / Networking mode. Choose on the Linux tab - Download.deb The download of the package will begin. In the network / Networking section, the name of the downloaded package will appear. Click on it and copy the URL, you will need it to download.

  6. Install ProtonMail Bridge (dpkg -i protonmail-bridge_2.4.8-1_amd64.deb). Specify the same package name (.deb) as in step 5. !If there are any errors during installation, then use the following command - sudo apt --fix-broken install dpkg -i protonmail-bridge_2.4.8-1_amd64.deb

  7. Let’s go to ProtonMail Bridge using the console without graphical interface (protonmail-bridge-cli)

  8. Go to the ProtonMail profile (we are in the protonmail-bridge command interface) add enter email address enter email password

  9. Make split configuration = each email will have its own mailbox and configuration. change mode yes To view all added mails, use the command list To view SMTP configuration use the command info (Copy your settings for email that you have added in step 8) To see all possible commands use the command help To exit use the command _exit _

  10. Exit the protonmail-bridge utility (exit)

  11. Install screen (sudo apt install screen) - a console utility that allows you to open an unlimited number of independent virtual terminals (windows) in an active SSH session. Processes running inside screen are not interrupted even if the session with the server is terminated => you can disconnect from the server, and the command that screen was given to execute will continue to be executed

  12. Make a script for screen (nano /var/lib/protonmail/protonmail.sh)

  13. Copy and paste this script and save. This script allows you to start, stop and het status of protonmail bridge utility in background. _#!/bin/bash

case “$1” in start)

will create an screen in detached mode (background) with name “protonmail”

screen -S protonmail -dm protonmail-bridge --cli echo “Service started.” ;; status)

ignore this block unless you understand how screen works and that only lists the current user’s screens

result=$(screen -list | grep protonmail) if [ $? == 0 ]; then echo “Protonmail bridge service is ON.” else echo “Protonmail bridge service is OFF.” fi ;; stop)

Will quit a screen called “protonmail” and therefore terminate the running protonmail-bridge process

screen -S protonmail -X quit echo “Service stopped.” ;; *) echo “Unknown command: $1” exit 1 ;; esac_

  1. Make this file executable (chmod +x /var/lib/protonmail/protonmail.sh)

  2. Let’s create a service, a service that will be responsible for executing the protonmail bridge (this service will call the written script) nano /etc/systemd/system/protonmail.service

  3. Copy and paste this script and save. Note that thisd example contains protonmail as a user that will use this script. You can th line User=protonmail by the line User=your_system_user _[Unit] Description=Service to run the Protonmail bridge client After=network.target

[Service] Type=oneshot User=protonmail ExecStart=/var/lib/protonmail/protonmail.sh start ExecStop=/var/lib/protonmail/protonmail.sh stop RemainAfterExit=yes

[Install] WantedBy=multi-user.target_

  1. Add the script to autoload = when the system is rebooted, the script will immediately begin to act (systemctl enable protonmail)

  2. Start the service (systemctl start protonmail)

  3. Check if it works (netstat -tulpn | grep 1025)

  4. Reboot the server to check if protonmail works after rebooting reboot netstat -tulpn | grep 1025 To stop the service use this command - systemctl stop protonmail To check the status of the service use this command systemctl status protonmail

msmtp with msmtp.service is the easy way to connect your droplet to an external SMTP server.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel