首先在自己的邮箱开启SMTP服务
yum list installed | grep mail 查看是否安装了mail
yum install mail 安装mail
编辑mail配置文件
vim /etc/mail.rc
set bsdcompat
set from=xxxxxxxxxx@163.com
set smtp=smtp.163.com
set smtp-auth-user=xxxxxxxxx@163.com
set smtp-auth-password=xxxxxxxx 千万注意不是邮箱密码,而是授权码
set smtp-auth=login
测试发送邮件
mail -s "test" z2251787410@163.com < /etc/mail.rc