Linux下发送邮件
1、安装
yum install mailx
2、设置
vim /etc/mail.rc
在文件最后添加
set [email protected]
set smtp=smtp.qq.com
set [email protected]
set smtp-auth-password=xxxxx
set smtp-auth=login
注意:
set smtp-auth-password=xxxxx 这里填写的并不是邮箱密码,而是邮箱授权码
出现 smtp-server: 535 Error: 这种错误很有可能就是因为授权码填错了
授权码需要登录自己的邮箱去设置获取
3、发送
echo “hello,this is the content of mail” | mail -s “Hello mail” [email protected]
4、查看