Centos 7 安装 Mail
1、安装 mailx
yum install mailx -y
2、配置
vi /etc/mail.rc
# 指定邮箱
set from=123456@qq.com
# 邮箱协议
set smtp="smtp.qq.com"
# 邮箱账号
set smtp-auth-user="123456@qq.com"
# 邮箱授权码,QQ邮箱后台里面去授权
set smtp-auth-password="abc*****"
# 登陆方式
set smtp-auth=login
3、发送
echo "hello" | mail -s "this is a test" abc@snail.com
# 参数
-s 邮件标题
echo "hello" 邮件的内容
# 或者通过一个文件发送
mail -s "this is test mail" abc@snail.com < /tmp/abc.txt
参考:
https://blog.csdn.net/mshxuyi/article/details/104693623/