Sendmail is only accepting connections from localhost (127.0.0.1 IP)

by on May 6, 2006 · 5 comments· LAST UPDATED December 18, 2007

in

Q. My sendmail service is running under Linux and whenever I try to telnet it from other LAN IP, it gives connection refuse error. If I connect it from localhost it accept connection. I can only send mail from my server only. How do I force sendmail to accept mail from other hosts/LAN ips?

A. For security reason sendmail is by default configured to accept connection from local system (127.0.0.1). This should avoid open mail relay problem.

To allow connections from ALL hosts/LAN IPs open sendmail.mc file (login as the root):

# vi /etc/mail/sendmail.mc

Look for line that read as follows:

DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

Comment or remove above line and insert new line that read as follows:

DAEMON_OPTIONS(`Port=smtp,Name=MTA')dnl

Above line will force to accept connection from any host. Save the file. Regenerate sendmail configuration file using m4:

# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

Restart sendmail service :

# /etc/init.d/sendmail restart

Caution: You should configure firewall and other Sendmail Anti-Spam configuration control to avoid problems.

See also:

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 5 comments… read them below or add one }

1 Moeed October 9, 2006 at 3:50 am

THanks!!! I was about to pull my hair out thinking it was my host. Such a simple fix.

Reply

2 Trent August 17, 2008 at 9:11 pm

That does not work. Sendmail still does not allow incoming connections, however it is now sending out mail.

Reply

3 juraj October 29, 2008 at 7:54 pm

Hello, this solution doesn’t work for me either, i tried even to specify to run the daemon on specific address but it still binds to localhost =(

Reply

4 Trent October 30, 2008 at 3:45 am

I gave up and just started using gmail for organizations. You can access via POP/SMTP or web.

Best of all it’s free

Reply

5 tom February 14, 2012 at 11:27 am

nice!! helped me a lot…
thnx for posting!

Reply

Leave a Comment

Tagged as: , , , , , , , , , , , , , ,

Previous post:

Next post: