Centos7下使用mail发送邮件
修改配置文件,配置邮件相关内容(追加到配置文件末尾)
[[email protected] ~]# vi /etc/mail.rc
set [email protected]
set smtp=smtp.qq.com
set [email protected]
set smtp-auth-password=password
set smtp-auth=login
set smtp-port=587
测试
echo "Hello, world" | mail -s "ceshi" [email protected]
如果不成功,执行下面操作
首先检测相关服务是否已安装
[[email protected] ~]# rpm -qa|grep mail
libreport-plugin-mailx-2.0.9-19.el6.x86_64
mailx-12.4-7.el6.x86_64
procmail-3.22-25.1.el6.x86_64
mailcap-2.1.31-2.el6.noarch
sendmail-8.14.4-8.el6.x86_64
若服务未安,则执行以下命令进行服务安装
[[email protected] ~]# yum install sendmail
[[email protected] ~]# yum install mailx –y
[[email protected] ~]# yum update libreport-plugin-mailx
[[email protected] ~]# yum -y install sharutils
[[email protected] ~]# yum install mutt
原文地址:http://blog.51cto.com/12736521/2311455