linux 外网发送邮件

安装:

yum -y install sendmail
yum -y install mailx

配置:

/etc/mail.rc 中添加下面两行

set from=email smtp=smtp.exmail.qq.com
set smtp-auth-user=email smtp-auth-password=password smtp-auth=login

email是要使用的邮箱
password 邮箱密码

可能需要重启sendmail服务

使用:

echo "mail contents " |mail -s 'subject'  [email protected],[email protected]

猜你喜欢

转载自blog.csdn.net/liyinwang/article/details/51833679