Sendmail

Sendmail: stat=Deferred: Connection refused by [127.0.0.1]

Posted by daro on July 04, 2014
Debian, Email, Linux, Sendmail / 5 Comments

 

Sendmail

 Sendmail not sending messages? There you go!

There is a very helpful manual on setting up sendmail server. However after following it I could receive but not send emails. Messages were queuing with status ‘Deferred: Connection refused by [127.0.0.1]’ and the same error could be found in /var/log/mail.log

Solution to it was just to simply add one more line to your sendmail configuration file /etc/mail/sendmail.cf. Enabling Mail Transport Authority to your local network adapter. By default part of this config file looks like this:

# SMTP daemon options
O DaemonPortOptions=Family=inet, Name=MTA-v4, Port=smtp, Addr=XX.XX.XX.XX
O DaemonPortOptions=Family=inet, Name=MSP-v4, Port=submission, M=Ea, Addr=127.0.0.1

Where XX.XX.XX.XX is an ip address of your public network interface. After enabling MTA on a local interface it should look like below:

# SMTP daemon options
O DaemonPortOptions=Family=inet, Name=MTA-v4, Port=smtp, Addr=XX.XX.XX.XX
O DaemonPortOptions=Family=inet, Name=MTA-v4, Port=smtp, Addr=127.0.0.1
O DaemonPortOptions=Family=inet, Name=MSP-v4, Port=submission, M=Ea, Addr=127.0.0.1

Then sendmail restart with ‘/etc/init.d/sendmail restart’ or ‘service sendmail restart’. Depending on your distro, and it finally started sending and receiving emails.