需求,系统日志等结果定时邮件推送
1 安装 sendmail
2 更改/etc/mail/sendmail.mc的DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl 地址为0.0.0.0
3 配置/etc/mail.rc
set ssl-verify=ignore
set nss-config-dir=/root/.certs
set from=user@domain.com
set smtp=smtps://smtp.ym.163.com:465
set smtp-auth-user=user@domain.com ##此处要写全,只写user貌似试了一次不可以
set smtp-auth-password=yourpassword
set smtp-auth=login
4 解决证书
mkdir -p /root/.certs/
echo -n | openssl s_client -connect smtp.163.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.certs/163.crt
certutil -A -n "GeoTrust SSL CA" -t "C,," -d ~/.certs -i ~/.certs/163.crt
certutil -A -n "GeoTrust Global CA" -t "C,," -d ~/.certs -i ~/.certs/163.crt
certutil -L -d /root/.certs
防止出现前文所说的发送邮件警告提示
cd /root/.certs/
certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ./ -i 163.crt
返回如下提示即可:
Notice: Trust flag u is set automatically if the private key is present.
5 服务器hostname 改成FQDN