[root@ml ~]# yum -y install mailx #安裝
[root@ml ~]# vim /etc/mail.rc
在最后一行添加(我這里使用的是qq郵箱):
set from=664268***@qq.com #來自 set smtp=smtp.qq.com #qq的smtp郵箱 set smtp-auth-user=664268***@qq.com #賬號 set smtp-auth-password=wzkwaotbwples*** #授權碼(下圖教怎么在q郵箱獲取) set smtp-auth=login #認證方式,可以是ssl,默認是login
選擇賬戶,然后往下滑。
測試:
[root@ml ~]# echo "你好" | mailx -s "meml" memlkk@163.com
使用465
mkdir -p /root/.certs/
echo -n | openssl s_client -connect smtp.qq.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.certs/qq.crt
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
certutil -L -d /root/.certs