mailx配置
1.編輯mail的配置文件
cat /etc/mail.rc
set bsdcompat
set from=xxx@qq.com # 發(fā)送郵件后顯示的郵件發(fā)送方
set smtp="smtps://smtp.qq.com:465" # qq smtp郵件服務(wù)器
set smtp-auth-user=xxx@qq.com # 你的qq郵箱
set smtp-auth-password=xxx # 你的qq郵箱密碼(設(shè)置頁(yè)面加密后的授權(quán)碼)
set smtp-auth=login # 動(dòng)作赔蒲、登錄
set ssl-verify=ignore # 忽略ssl驗(yàn)證
set nss-config-dir=/root/.certs # 證書(shū)路徑
2.添加郵箱證書(shū)到本地
yum -y install nss-tools
# 創(chuàng)建證書(shū)目錄
mkdir -p /root/.certs/
# 獲取證書(shū)內(nèi)容
echo -n | openssl s_client -connect smtp.qq.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.certs/qq.crt
# 添加證書(shū)到數(shù)據(jù)庫(kù)
certutil -A -n "GeoTrust SSL CA" -t "C,," -d ~/.certs -i ~/.certs/qq.crt
certutil -A -n "GeoTrust Global CA" -t "C,," -d ~/.certs -i ~/.certs/qq.crt
# 受信任證書(shū)泌神、防報(bào)錯(cuò)
certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ~/.certs -i ~/.certs/qq.crt
3.驗(yàn)證
echo "test test test" | mail -s "title-mail" xxx@qq.com