報(bào)錯(cuò):
[root@web01 ~]# echo 222 | mail -s "test" 996.....78@qq.com
[root@web01 ~]# Error initializing NSS: Unknown error -8015.
"/root/dead.letter" 11/290
. . . message not sent.
解決思路:查看證書
全教程如下
1,下載
[root@web01 ~]#?yum -y install mailx
2,配置mail
[root@web01 ~]#?vim /etc/mail.rc
set from=xxxxxx@qq.com
set smtp=smtps://smtp.qq.com:465
set smtp-auth-user=xxxxxx@qq.com
set smtp-auth-password=你的 QQ 郵箱授權(quán)碼
set smtp-auth=login
set ssl-verify=ignore
set ssl-verify=ignoreset nss-config-dir=/root/.certs
3,配置QQ郵箱的SSL證書
[root@web01 ~]#?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
為了防止出現(xiàn)前文所說(shuō)的發(fā)送郵件警告提示,還需要進(jìn)入郵箱 SSL 證書存放目錄 /root/.certs 里執(zhí)行如下命令:
[root@web01 ~]# cd /root/.certs
[root@web01 .certs]# certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ./ -i qq.crt
Notice: Trust flag u is set automatically if the private key is present.出現(xiàn)這句就可以
4.通過(guò)命令行發(fā)送測(cè)試郵件
[root@web01 ~]# echo 222 | mail -s "test" 99...78@qq.com