Configurei o MSMTP com o seguinte, mas se eu enviar um e-mail da CLI, ele será bloqueado ou terminará em meu SPAM porque não tem TO / FROM nem nada no topo. Mas os e-mails do CRON estão formatados corretamente.
sudo apt-get update
sudo apt-get install -y msmtp msmtp-mta
# MSMTPRC Configuration
cat << EOL >/etc/msmtprc
# Set default values for all following accounts.
defaults
auth on
tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile /var/log/msmtp.log
aliases /etc/aliases
# Comcast
account Comcast
host smtp.hmc1.comcast.net
port 587
from USER@COMCAST
user USER@COMCAST
password PWD
account default : Comcast
EOL
# Set Strong Permissions due to Plain Text PWD
sudo chmod 600 /etc/msmtprc
# Configure User Alias
cat << EOL >/etc/aliases
# Example aliases file
# Send root to Joe and Jane
#root: [email protected], [email protected]
# Send everything else to admin
#default: [email protected]
# Send cron to Mark
#cron: [email protected]
#############################
root : [email protected]
EOL
# Needed for Mail Command
cat << EOL >/tmp/testfile
To: [email protected]
From: [email protected]
Subject: E-Mail Setup Script has Completed Successfully
"${HOSTNAME} Has been configued to use msmtp, this program will e-mail all CRON results automatically, but does not suporrt the "mail -s" command
EOL