ssmtp - simple mail forward

Wish to sent email from bash scripts without dealing with things like postfix, dkim and all other fancy stuff

sudo apt install -y ssmtp

sudo tee /etc/ssmtp/ssmtp.conf > /dev/null <<EOT
[email protected]
mailhub=smtp.gmail.com:587
hostname=smtp.gmail.com:587
FromLineOverride=YES
UseTLS=YES
UseSTARTTLS=YES
[email protected]
AuthPass=***********
EOT

sudo tee /etc/ssmtp/revaliases > /dev/null <<EOT
root:[email protected]:smtp.gmail.com:587
mac:[email protected]:smtp.gmail.com:587
EOT

If 2FA enabled AuthPass should be obtained from app passwords page

Test how it works

sudo apt install mailutils

echo "direct to myself" | mail -s "direct to myself" [email protected]