yum install mailx

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

#smtp-auth-password的密码是qq邮箱里面设置的第三方登录密码

#创建证书
mkdir -p /root/.certs/
echo -n | openssl s_client -connect smtp.163.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.certs/163.crt #向163请求证书
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 ##列出目录下证书
#信任证书
certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ./ -i 163.crt

测试:
mail -s "test" [email protected] < /root/log