mai.rc 配置腾讯企业邮箱服务器地址来发送邮件

/etc/mail.rc 配置文件内容如下:

[root@tidb06 nssdb]# tail -10 /etc/mail.rc 
#For Linux and BSD, this should be set.
set bsdcompat

set smtp=smtps://smtp.exmail.qq.com:465
set smtp-auth=login
set smtp-auth-user=test@edianhua.com
set smtp-auth-password=Wjw#edianhua6
set ssl-verify=ignore
set nss-config-dir=/etc/pki/nssdb
set from=test@edianhua.com

测试发送出现告警:但是测试是可以正常发送邮件的,但是看着就是不爽

[root@tidb06 nssdb]# echo 'test' | mail -s 'test'  test@edianhua.com
[root@tidb06 nssdb]# Error in certificate: Peer's certificate issuer is not recognized.

解决过程如下:

[root@tidb06 nssdb]# certutil -A -n 'exmailqq' -t "P,P,P" -d ./ -i exmail.qq.crt 
certutil:  unable to open "exmail.qq.crt" for reading (-5950, 2).
[root@tidb06 nssdb]# touch exmail.qq.crt 
[root@tidb06 nssdb]# certutil -A -n 'exmailqq' -t "P,P,P" -d ./ -i exmail.qq.crt 
certutil: could not decode certificate: SEC_ERROR_INVALID_ARGS: security library: invalid arguments.

一直报错
参考下面文章解决
https://blog.csdn.net/yongren_z/article/details/85119088
https://www.cnblogs.com/xuziyu/p/10708015.html

具体解决办法如下:


[root@tidb06 nssdb]#  echo -n "" | openssl s_client -connect smtp.exmail.qq.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > qq.crt
depth=2 C = US, O = DigiCert Inc, OU = www.digicert.com, CN = DigiCert Global Root CA
verify return:1
depth=1 C = US, O = DigiCert Inc, OU = www.digicert.com, CN = Secure Site CA G2
verify return:1
depth=0 C = CN, ST = Guangdong Province, L = Shenzhen, O = Tencent Technology (Shenzhen) Company Limited, OU = R&D, CN = exmail.qq.com
verify return:1
DONE

下面才是正确的输出:

[root@tidb06 nssdb]# certutil -A -n 'qq' -t "P,P,P" -d . -i ./qq.crt
Notice: Trust flag u is set automatically if the private key is present.

到此时不在出现警告:
[root@tidb06 nssdb]# echo 'test' | mail -s 'test' test@edianhua.com
[root@tidb06 nssdb]#

上一篇:Linux启动流程


下一篇:隔直网络(无源RC高通滤波)中电容充放电时间对信号处理及测量(以检波为例)的影响分析