1、安装 mailx
yum install mailx -y
2、配置
[root@backup ~]#vi /etc/mail.rc
set from=tangyingjie2021@126.com
set smtp="smtp.126.com"
set smtp-auth-user="tangyingjie2021@126.com"
set smtp-auth-password="HMGQAZORENYBKHTH"
set smtp-auth=login
3测试:
echo "hello" | mail -s "this is a testmail" 66907360@qq.com