1.yum安装mailx
yum -y install mailx
2.编辑/etc/mail.rc
#在文件最底行添加即可
set from=网易邮箱@163.com
set smtp=smtp.163.com
set smtp-auth-user=网易邮箱@163.com
set smtp-auth-password=网易给的授权码
set smtp-auth=login
set ssl-verify=ignore
3.授权码的获取
点击图一的2开启图二的1,2后在进行图一3的操作
4测试发送
echo 'hhhhhhhh' | mailx -s 'test.' 网易邮箱@163.com