我正在运行RHEL 6,并已经做了以下修改:
[root@ark mail]# grep 0.0.0.0 sendmail.mc DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl [root@ark mail]# make sendmail.cf
确保它适用于:
[root@ark mail]# grep 0.0.0.0 sendmail.cf O DaemonPortOptions=Port=smtp,Addr=0.0.0.0, Name=MTA #O ClientPortOptions=Family=inet, Address=0.0.0.0 #O ConnectOnlyTo=0.0.0.0 [root@ark mail]# makemap -v hash access.db < access key=`connect:localhost.localdomain', val=`RELAY' key=`connect:localhost', val=`RELAY' key=`connect:127.0.0.1', val=`RELAY' key=`connect:[my.remote.ip]', val=`RELAY'
但是它仍然听取127.0.0.1:
[root@ark mail]# netstat -lptun | grep 25 tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1174/master
我已经重新启动了几次sendmail。
[root@server mail]# netstat -vatn Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
通过查看几个文件后,我发现如何解决这个问题:
首先你需要编辑/etc/mail/sendmail.mc,find以下部分:
dnl This changes sendmail to only listen on the loopback device 127.0.0.1 dnl and not on any other network devices. Comment this out if you want dnl to accept email over the network. DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')
你需要用DAEMON_OPTIONS注释掉,在行开头使用“dnl”:
dnl This changes sendmail to only listen on the loopback device 127.0.0.1 dnl and not on any other network devices. Comment this out if you want dnl to accept email over the network. dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')
您将需要重build该文件:
m4 /etc/mail/sendmail.mc > /etc/sendmail.cf
一旦你完成了这个任务,sendmail将监听系统上的所有IP地址:
[root@server mail]# netstat -vatn Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN
你可以从别人那里收到邮件,并从你的客户发送邮件。
看看/etc/sysconfig/mail 。 你不能错过遥控设置。