转载自:https://www.cnblogs.com/nulige/p/9092105.html
#创建证书
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,255);">certutil -L -d /root/.certs
#信任证书
certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ./ -i qq.crt
# 配置/etc/mail.rcE繁忙
set smtp="smtps://smtp.qq.com:465"
set smtp-auth=login
set smtp-auth-user="228444347@qq.com" #换成你的QQ邮箱
set smtp-auth-password="fwmazaxbllqrcajg" # 换成你的QQ邮箱第三方登录密码
set ssl-verify=ignore
#set nss-config-dir=/etc/pki/nssdb
set nss-config-dir=/root/.certs
说明:
#smtp-auth-password的密码是QQ邮箱里面设置的第三方登录密码,不是你qq的密码,在QQ邮箱设置界面配置
测试:
echo message3 | mail -v -r "" -s "hello world"228444347@qq.com
注意:一定要带-r参数,生产上去掉-v参数