msmtp Empty TO and FROM Field - All mail ends up in Bulk Mail when sent from CLI or manually
7
votes
1
answer
1543
views
I have set up MSMTP with the following but if I send an e-mail from the CLI it either gets blocked, or ends up in my SPAM because it has no TO/FROM or anything up top. But e-mails from CRON are properly formatted.
sudo apt-get update
sudo apt-get install -y msmtp msmtp-mta
# MSMTPRC Configuration
cat /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 /etc/aliases
# Example aliases file
# Send root to Joe and Jane
#root: joe_smith@example.com, jane_chang@example.com
# Send everything else to admin
#default: admin@domain.example
# Send cron to Mark
#cron: mark_jones@example.com
#############################
root : sysalert@company.com
EOL
# Needed for Mail Command
cat /tmp/testfile
To: john@company.com
From: server@company.com
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

Asked by FreeSoftwareServers
(2682 rep)
Sep 21, 2016, 02:02 PM
Last activity: Oct 23, 2019, 07:35 PM
Last activity: Oct 23, 2019, 07:35 PM