企业 zabbix server迁移到阿里云服务器,迁移过程中发现邮件告警功能无法使用。特记录下解决过程,
备注:阿里云默认是关闭25端口的,使用25端口需要申请,要一天时间,等不了那么久。就使用465加密端口发送邮件,以下是实施过程。

  1. 安装mailx
    yum -y install mailx

腾讯企业邮箱配置

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

生成证书

echo -n | openssl s_client -connect smtp.qq.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /etc/pki/nssdb/qq.crt 
certutil -A -n "GeoTrust SSL CA" -t "C,," -d /etc/pki/nssdb/ -i /etc/pki/nssdb/qq.crt 
certutil -A -n "GeoTrust Global CA" -t "C,," -d /etc/pki/nssdb/ -i /etc/pki/nssdb/qq.crt 
certutil -L -d /etc/pki/nssdb/ 
certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ./ -i qq.crt #认证
同样,认证完会返回如下提示:
Notice: Trust flag u is set automatically if the private key is present.

测试发送邮件

echo "test "|mail -v -s "test"  [email protected]