≡ Menu

Sendmail is only accepting connections from localhost ( IP)

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 ( 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=, Name=MTA’)dnl

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


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:

Share this on:
{ 5 comments… add one }
  • Moeed October 9, 2006, 3:50 am

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

  • Trent August 17, 2008, 9:11 pm

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

  • juraj October 29, 2008, 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 =(

  • Trent October 30, 2008, 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

  • tom February 14, 2012, 11:27 am

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

Security: Are you a robot or human?

Leave a Comment

   Tagged with: , , , , , , , , , , , , , ,