shell 下 用mail 发送邮件

 停掉sendmail    /etc/init.sendmail stop ;          chkconfig sendmail off ;
yum -y install postfix*
service postfix start
yum -y install dovecot*
配置postfix
vim /etc/postfix/main.cf
myhostname = mail.g.cn
mydomain = g.cn
myorigin = $myhostname
myorigin = $mydomain
//监听端口
inet_interfaces = all
#inet_interfaces = $myhostname
#inet_interfaces = $myhostname, localhost
#inet_interfaces = localhost
inet_protocols = ipv4 
//收件目标
mydestination = $myhostname,$mydomain
mynetworks = IP.0/28, 127.0.0.0/8
//转发
relay_domains = $mydestination
//计算机默认邮件程序
alternatives --config mta 
 
 
原文地址:https://www.cnblogs.com/cnsanshao/p/2680200.html