一、安裝sendmailvim
# yum install -y sendmail測試
# yum install -y sendmail-cfspa
二、配置發送郵件的郵箱認證信息orm
# vim /etc/mail.rc ci
在後面添加一下內容:it
set from=xxxxx@xxx.com #發送者的郵箱登錄
set smtp=smtp.exmail.qq.com #郵箱的SMTP配置
set smtp-auth-user=xxxxx@xxx.com #發送者的郵箱密碼
set smtp-auth-password=***** #郵箱密碼im
set smtp-auth=login #自動登陸
三、測試發送郵件
echo '郵件內容' | mail -s "郵件標題" -r xxxxx@xxx.com hhh@163.com aaa@163.com
說明:xxxxx@xxx.com爲發送者郵箱,要和第二步設置郵箱一致,hhh@163.com aaa@163.com是收件人,多個收件人用空格隔開。