Deferred: Connection refused by localhost

tom on October 11th, 2006

I have a box that is supposed to send out email. I noticed that none of these emails were actually getting sent!

I looked through my /var/log/maillog log and found some lines that looked like this:

Oct 11 15:39:33 server sendmail[12789]: k9BKdX65012789: from=root, size=802, class=0, nrcpts=1, msgid=, relay=root@localhost
Oct 11 15:39:33 server sendmail[12789]: k9BKdX65012789: to=admin@somedomain.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30802, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]

So I figured that the localhost must not be properly configured in my /etc/hosts file, and lo and behold, it wasn’t!
I changed the line in /etc/hosts to read:

127.0.0.1 localhost localhost.localdomain

Now I must wait for it to update the hosts… It seems to not have worked. Maybe there is something else wrong with sendmail or my server config.
Being that this is a Linux Learning Experience I will post my experience here and provide the solution to all of my problems that I have.

An update to my problem: I edited the sendmail configuration source file located at /etc/mail/sendmail.mc

I found the line that read:

DAEMON_OPTIONS(`Port=smtp,Addr=10.10.10.10, Name=MTA’)dnl

where 10.10.10.10 may possibly be 127.0.0.1 or your server IP address.

What I did was I added dnl at the beginning of the line to comment it out.

Then I had to recompile sendmail configuration by executing the following commands:

# cd /etc/mail

# m4 sendmail.mc > sendmail

# /sbin/service sendmail restart

This seemed to work as all my email is getting sent without any loopbacks or errors. Despite my load average: 2.85, 2.09, 1.92

But that’s a different story!


Comments are closed.