mkdir -p /root/.certs/ echo -n | openssl s_client -connect smtp.mxhichina.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.certs/ali.crt
certutil -A -n "GeoTrust SSL CA" -t "C,," -d ~/.certs -i ~/.certs/ali.crt certutil -A -n "GeoTrust Global CA" -t "C,," -d ~/.certs -i ~/.certs/ali.crt
certutil -L -d /root/.certs
yum -y install mailx
set from=test@ccc.com set smtp=smtps://smtp.mxhichina.com:465 set smtp-auth-user=test@ccc.com set smtp-auth-password=password(授权密码) set smtp-auth=login set ssl-verify=ignore set nss-config-dir=/root/.certs
cd /root/.certs/ certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ./ -i ali.crt
有这个提示,说明SSL证书配置生成及安装完成 。不执行会导致发送提示证书不被信任,但是仍可以发送.
发送邮件
echo “zabbix test mail” | mail -s “zabbix” cc_test@abc.com
如果发送失败 检查文件夹权限和文件权限并根据报错查看