I am trying to set up an email server but my server is not receiving any emails.  I discovered that port 25 is being blocked. When I do iptables -L I do not see any firewall rules.  I am running RHEL6.When I telnet localhost 25 I can connect.# telnet localhost 25Trying 127.0.0.1...Connected to localhost.Escape character is '^]'.220 mailvm2.example.com ESMTP Sendmail 8.14.4/8.14.4; Wed, 16 Mar 2016 12:06:43 -0700^]telnet> quitConnection closed.But when I use the host's hostname I get Connection refused.# telnet mailvm2 25Trying XXX.70.163.117...telnet: connect to address XXX.70.163.117: Connection refusedI figure there must be some sendmail configuration change I missed.Any help is appreciated. UPDATE:Running netstat -alt | grep 25 produces no output.# netstat -alt | grep 25# ThanksUPDATE: Thank you Andrzej I have made this change# pwd/etc/mail# cp sendmail.mc sendmail.mc.127.0.0.1 # vi sendmail.mc... # diff sendmail.mc sendmail.mc.127.0.0.1 118c118< DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0,Name=MTA')dnl---> DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnland then I ran make and service sendmail restart and now I am able to connect! Thanks!
Why does telnet localhost 25 works and telnet mailvm2 25 get Connection refused?
sendmail
Your sendmail may be configured in client only mode (internal and send out) without accepting emails from outside.  In such mode sendmail accepts SMTP connection only on loopback interface (127.0.0.1:25).https://www.sendmail.com/sm/open_source/support/support_faq/general_issues_faq/#4.22