2017年11月28日 星期二

Centos sendmail by gmail

#install ssmtp
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


沒有留言:

張貼留言

Centos GUI Webserver 設定

新灌的一台Centos7可以做以下的設定 語系設定: - sudo localectl set-locale LC_CTYPE=zh_TW.UTF-8 修改ssh port - http://linux.vbird.org/linux_server/0310telne...