sudo yum install ssmtp -y
sudo cp /etc/ssmtp/ssmtp.conf /etc/ssmtp/ssmtp.conf.bak
vim /etc/ssmtp/ssmtp.conf
====
root=xxxxx@gmail.com
mailhub=smtp.gmail.com:587
Hostname=localhost
FromLineOverride=YES
UseTLS=YES
UseSTARTTLS=YES
AuthUser=xxxx@gmail.com
AuthPass=xxxxx
=====
#send test mail by ssmtp
echo "This is a test" | ssmtp recipient@your.domain.com
#change command mail default
alternatives --config mta
(choose)
echo "This is a test" | mail -s "Title" xxxxx@gmail.com
#set server reboot and mail to admin
sudo vim /etc/rc.d/rc.local
===
# wait 2min to sure all service open
(sleep 120
echo -e "`who -b`\n`ifconfig`\n`systemctl list-units | grep running`" | mail -s "Server on" xxxx@gmail.com
)&
====
sudo chmod u+x /etc/rc.d/rc.local