Sendmail is only accepting connections from localhost (127.0.0.1 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 (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:
Want to stay up to date with the latest Linux tips, news and announcements? Subscribe to our free e-mail newsletter or RSS feed to get all updates.
You can Email this page to a friend.
You may also be interested in other helpful articles:
- Force sendmail to deliver a message in sendmail’s mail queue
- Routing all mail to unknown users to a single mail account
- Sendmail masquerade outgoing email address
- Tutorial: Set up Sendmail, dovecot, SpamAssassin, ClamAV as a email server
- Setup sendmail php mail() support for chrooted Lighttpd or Apache web server
Discussion on This Article:
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!
Tags: addr, configuration file, configured, daemon, hosts, lan, Linux, local system, m4, mail relay, mta, open mail, running under linux, security reason, smtp


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