在阿里云配置邮箱通知

参考文档

https://yq.aliyun.com/articles/644134

在linux使用mailx发送邮件
但是在阿里云的服务器是直接禁止使用25端口的

yum install -y mailx

配置 mailx

vim /etc/mail.rc 
set smtp=smtps://smtp.qq.com:465
set [email protected]
set [email protected]
set smtp-auth-password=yourpassword
set smtp-auth=login
set ssl-verify=ignore
set nss-config-dir=/root/.certs

生成证书文件

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

发邮件测试

echo "241"|mail -s "214145" [email protected]

你可能感兴趣的:(在阿里云配置邮箱通知)