云服务器默认关闭了25端口,现改用465端口,需要证书,需要下载
关闭其它的邮件工具 service sendmail stop service postfix stop
向qq请求证书 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 -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ~/.certs/./ -i qq.crt
certutil -L -d /root/.certs
默认是有mailx的,直接更改配置文件,末尾追加 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=xxxx
set smtp-auth=login
set ssl-verify=ignore
set nss-config-dir=/root/.certs
发送邮件测试 echo “邮件正文” | mail -s “邮件主题” xxx@qq.com
|