操作系统版本Centos7.6
1、获取qq邮箱授权码
按照提示发短信,拿到授权码
2、登录linux主机配置mail服务
cp /etc/mail.rc /etc/mail.rc.bak 备份配置文件
vim /etc/mail.rc 打开配置文件,在文件最后添加如下内容:
set from=xxx@qq.com
set smtp=smtps://smtp.qq.com:465
set smtp-auth-user=xxx@qq.com
set smtp-auth-password=xxx
set ssl-verify=ignore
set nss-config-dir=/root/.certs
set smtp-auth=login
3、执行以下命令生成qq邮箱SSL证书
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
cd /root/.certs/
certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ./ -i qq.crt
4、查看ssl证书
5、测试发送邮件
给163的邮箱发送一封测试邮件
echo "hello" | mail -v -s "test" xxx@163.com
-s:指定邮件标题
-v:显示发送过程详情