yum install msmtp
yum install ca-certificates
Create /etc/msmtprc
#set default values for all following accounts.
defaults
auth on
tls on
tls_trust_file /etc/pki/tls/certs/ca-bundle.crt
logfile ~/.msmtp.log
# Gmail
account gmail
host smtp.xxx.com
port 587
from xxx@yyy.com
user xxx@yyy.com
password zzz
# Gmail
account anotherprovider
host smtp.anotherprovider.net
port 587
from @anotherprovider.net
user @anotherprovider.net
password
# Set a default account
account default : gmail
echo "Hello this is sending email using msmtp" | msmtp recipent@domain.com
Create a file email.txt
To: xxx@yyy.com
From: aaa@bbb.com
Subject: Email Test using MSMTP from File
Hi,
This is an email test from file.
yum install mutt
Edit /root/.muttrc
set sendmail="/usr/bin/msmtp"
set from="Fred Bloggs <xxx@yyy.com>"
create report if you don't have one
logwatch --detail High --filename report.txt
echo "Logwatch Report attached." | mutt -d 1 -s "Subject" person@receiving.com -a ./report.txt