[root@ml ~]# yum -y install mailx #安装
[root@ml ~]# vim /etc/mail.rc
在最后一行添加(我这里使用的是qq邮箱):
set from=664268***@qq.com #来自 set smtp=smtp.qq.com #qq的smtp邮箱 set smtp-auth-user=664268***@qq.com #账号 set smtp-auth-password=wzkwaotbwples*** #授权码(下图教怎么在q邮箱获取) set smtp-auth=login #认证方式,可以是ssl,默认是login
选择账户,然后往下滑。
测试:
[root@ml ~]# echo "你好" | mailx -s "meml" memlkk@163.com
使用465
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 -L -d /root/.certs