准备
首先需要获得QQ邮箱授权码,进入邮箱账户即可获得
配置/etc/mail.rc
在/etc/mail.rc中追加如下内容配置smtp服务
set from=148******@qq.com
set smtp=smtps://smtp.qq.com:465
set smtp-auth-user=148*******@qq.com
set smtp-auth-password=**********
set ssl-verify=ignore
set nss-config-dir=/root/.certs
set smtp-auth=login
建立nss-config-dir对应的证书
接下来我们需要生成nss-config-dir指定的证书文件,输入如下指令生成证书
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
certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ./ -i qq.crt
执行完上述指令后生成如下文件
测试
echo "测试邮件" | mail -s "测试" 86********@qq.com
-s 为邮箱标题
|