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
root=marchenko.alexandr@gmail.com
mailhub=smtp.gmail.com:587
hostname=smtp.gmail.com:587
FromLineOverride=YES
UseTLS=YES
UseSTARTTLS=YES
AuthUser=marchenko.alexandr@gmail.com
AuthPass=***********
EOT
sudo tee /etc/ssmtp/revaliases > /dev/null <<EOT
root:marchenko.alexandr@gmail.com:smtp.gmail.com:587
mac:marchenko.alexandr@gmail.com:smtp.gmail.com:587
EOTIf 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" marchenko.alexandr@gmail.com