阿里云默认25端口是封掉的,所以需要借助465端口来发送邮件
1.sheng生产一系列证书
mkdir ~/.certs
#生成证书
echo -n | openssl s_client -connect smtp.163.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.certs/mail.crt
certutil -A -n "GeoTrust SSL CA" -t "C,," -d ~/.certs -i ~/.certs/mail.crt
certutil -A -n "GeoTrust Global CA" -t "C,," -d ~/.certs -i ~/.certs/mail.crt
certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ~/.certs -i ~/.certs/mail.crt
#查看
certutil -L -d /root/.certs
2配置mail.rc文件
set [email protected] set smtp=smtps://smtp.163.com:465 set [email protected] set smtp-auth-password=xxxxxxxxxxxxx set smtp-auth=login set ssl-verify=ignore set nss-config-dir=/root/.certs 3.测试
echo Hello World | mail -s haha [email protected]