Setting up MSMTP for Protonmail

This is the config that worked for me.

First generate an SMTP token and a separate address for the system to use within Protonmail, otherwise this is not going to work without installing mail-bridge or something similar.

This will be special@domain.com

MSMTP Configuration file

Configuration file is /etc/msmtprc
File owner should be root:msmtp
File permissions 0660

defaults
tls on account default host smtp.protonmail.ch port 587 from special@domain.org set_from_header on auth on user special@domain.org password SMTP_TOKEN_GOES_HERE auth plain

Installation

Install the following components:

sudo apt install msmtp msmtp-mta mailutils bsd-mailx

Configuration

Edit the configuration file for mail /etc/mail.rc and add the following line to it:

set mta=/usr/bin/msmtp

You may also set up aliases if you like in the file /etc/aliases where you can add lines such as:

root: master@domain.org
caroline: caroline@example.com
defaul: admin@domain.org