centos 发送邮件

1. 检查是否安装了sendmail
rpm -qa | grep sendmail

2. 安装sendmail
yum install -y sendmail
yum install -y sendmail-cf

3.配置外部的smpt服务
set from=fromUser@domain.com smtp=smtp.domain.comset smtp-auth-user=username smtp-auth-passsword=passwordset smtp-auth=login

说明:

from是发送的邮件地址

smtp是发生的外部smtp服务器的地址

smtp-auth-user是外部smtp服务器认证的用户名

smtp-auth-password是外部smtp服务器认证的用户密码

smtp-auth是邮件认证的方式

4.测试发送邮件
echo 'hello!' | sendmail -s "hello test" username@qq.com

请使用浏览器的分享功能分享到微信等