基于Centos邮件服务实践

/ Linux服务安装搭建 / 没有评论 / 1075浏览

先安装一个sendmail程序

yum -y install sendmail

开启服务

service sendmail start

安装mail命令

yum install -y mail

配置相关文件

此时该文件生成,文件末尾加入,注意,此时的密码不是邮箱密码,应该是授权码,且需要开通相关权限

vim /etc/mail.rc 

set from=18629359835@163.com
set smtp=smtp.163.com
set smtp-auth-user=18629359835
set smtp-auth-password=swl521521521
set smtp-auth=login

发送邮件试试?

两种形式

echo "hello,echo"|mail -s "lijinghua" 598820383@qq.com
touch body.txt
mail -s 'Test mail' 598820383@qq.com < body.txt