Cent OS 利用Sendmail發送郵件
阿新 • • 發佈:2017-06-28
centos sendmail
1 安裝相關的軟件包:
[[email protected] ~]# uname -r
3.10.0-123.9.3.el7.x86_64
[[email protected] ~]# yum -y install sendmail mailx
2 修改host文件,本機IP為192.168.1.12:
[[email protected] ~]# hostname
ansible
[[email protected] ~]# vim /etc/hosts
192.168.1.12 ansible localhost.localdomain
3 重啟sendmail服務:
[[email protected] ~]# systemctl restart sendmail.service
4 測試郵件發送,-s為標題,內容需要手動輸入,然後按回車鍵,ctrl+d結束輸入:
[[email protected] ~]# mail -s "a" [email protected]
dd
EOT
上面發送郵件的方式,是在沒有公網域名解析下的權宜之計,用這種方式任何一臺Linux服務器都可以向外發送郵件,ansible是用在內網解析的計算機名稱。
本文出自 “一萬年太久,只爭朝夕” 博客,請務必保留此出處http://zengwj1949.blog.51cto.com/10747365/1942737
Cent OS 利用Sendmail發送郵件