mail报错

报错:

[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 邮箱授权码

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

为了防止出现前文所说的发送邮件警告提示,还需要进入邮箱 SSL 证书存放目录 /root/.certs 里执行如下命令:

[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.出现这句就可以


4.通过命令行发送测试邮件

[root@web01 ~]# echo 222 | mail -s "test" 99...78@qq.com

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。