yum install mailx -y
vim /etc/mail.rc #末尾添加发送者邮件地址
set from=xxxxx@qq.com
set smtp=smtp.qq.com
set smtp-auth-user=xxxxx@qq.com
set smtp-auth-password=邮箱密码
set smtp-auth=login
systemctl restart postfix.service #重启服务
#测试发送信息
echo "hello world" | mail -s "testmail" xxxxxxxx@139.com
[root@bogon ~]# echo "hello world" | mail -s "testmailsmtp-server: 535 Error: ȫʹԃ˚ȨëµȂ¼¡£Ъȩȫ¿´: http://service.mail.qq.com/cgi-bin/help?subtype=1&&id=28&&no=1001256
"/root/dead.letter" 11/305
. . . message not sent.
#信息发送失败
#解决方法
vim /etc/mail.rc #末尾添加发送者邮件地址
set from=xxxxx@qq.com
set smtp=smtp.qq.com
set smtp-auth-user=xxxxx@qq.com
set smtp-auth-password=邮箱密码 # 邮箱密码使用SMTP授权码
set smtp-auth=login
systemctl restart postfix.service #重启服务