I want to configure a Linux Sendmail server to deliver mail from localhost to support sending e-mail from a Web application on the same machine. The sendmail service will deliver mail from remote systems, but mail originating on the local system results
I want to configure a Linux Sendmail server to deliver mail from localhost to support sending e-mail from a Web application on the same machine. The Sendmail service will deliver mail from remote systems, but mail originating on the local system results in a mail log message that ends with ‘dsn 4.0.0. Status: deferred, connection refused’. I added localhost to the ‘local-host-names’ file in the /etc/mail folder and restarted Sendmail but still get the error message for local mail.
It sounds like Sendmail is ignoring connection requests on the localhost address 127.0.0.1. This is the default behavior in newer versions of Sendmail and is meant to make it more difficult for spammers to relay spoofed e-mail through your mail server.
Enabling local mail delivery can be made safer by adjusting your firewall to allow only localhost to accept connections to Port 25 from localhost itself. To enable Sendmail connections to localhost from localhost, add the localhost address 127.0.0.1 to the DaemonPortOptions setting in the Sendmail configuration file.
Make the changes to the /etc/mail/sendmail.mc file, then regenerate the sendmail.cf file and restart Sendmail. Many Linux systems rebuild sendmail.cf every time /etc/init.d/sendmail is used to start Sendmail, so making the change may be as simple as adding the line “DAEMON_OPTIONS(‘Port=smtp,Addr=127.0.0.1, Name=MTA’)dnl” below the existing DAEMON_OPTIONS line in sendmail.mc and issuing the command /etc/init.d/sendmail restart.




