vi /etc/mail/sendmail.mc
1.找到下面这行
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
将它改为下面这样即可
DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl
2.备份旧的设置文件数据
cd /etc/mail
mv senmail.cf sendmail.cf.bak
3.开始建立新的sendmail.cf配置文件
m4 sendmail.mc > sendmail.cf
当处理完后,需要重新启动sendmail 并检查一下SMTP的监听端口:
l //etc/init.d/sendmail restart
l netstat -tlnup |grep 25
错误2:
配置sendmail,生成配置文件时,出现以下错误:
[root@server mail]# m4 sendmail.mc >sendmail.cf
sendmail.mc:10: m4: cannot open `/usr/share/sendmail-cf/m4/cf.m4': No such file or directory
通过安装sendmail-cf解决
[root@server mail]# yum -y install sendmail-cf
# /etc/init.d/sendmail start
启动 sendmail:451 4.0.0 /etc/mail/sendmail.cf: line 91: fileclass: cannot open '/etc/mail/local-host-names': World writable directory
451 4.0.0 /etc/mail/sendmail.cf: line 588: fileclass: cannot open '/etc/mail/trusted-users': World writable directory [失败]
解决方法:
1.设置合理权限
Java代码
chmod go-w /etc/mail /usr /var /var/spool /var/spool/mqueue
2、放松文件权限检查:
1.替换/etc/mail/sendmail.cf 中
2.第91行Fw/etc/mail/local-host-names为Fw-o /etc/mail/local-host-names
3.第588行Ft/etc/mail/trusted-users为Ft-o /etc/mail/trusted-users
4.替换/etc/mail/submit.cf中
5.第545行Ft/etc/mail/trusted-users为Ft-o /etc/mail/trusted-users
-----------------------------------------------------------
[root@localhost mail]# netstat -nutplt|grep 25
tcp 0 0 0.0.0.0:25 0.0.0.0:* LIST EN 7989/sendmail: acce
tcp 0 0 :::1311 :::* LIST EN 25303/dsm_om_connsv
此时可看到MTA已经针对internet来监听了,自然我们的主机名称就要设置正确才行。否则主机默认只会接收localhost这个主机名称的信件。
vi /etc/mail/local-host-names
localhost.localdomain
mail.qq.com
-------------------------
[root@localhost] service sendmail restart
关闭 sm-client: [确定]
关闭 sendmail: [确定]
启动 sendmail: [确定]
启动 sm-client: [确定]
阅读(1962) | 评论(0) | 转发(0) |