How do I configure sendmail?

I am trying to run sendmail from a script with the results from that same script.
Each time I use sendmail I get the following message in /var/log/maillog:

Feb 27 02:25:42 (none) sendmail[13841]:
 m1R1Pg3S013841: to=test@test.com,just,testing,
 ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay,
 pri=94953, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred:
 Connection refused by [127.0.0.1]

Also the command telnet localhost 25, or telnet "my current IP" 25 give "connection refused"

I have no idea where to start, I did read about sendmail.mc file but in /etc/mail I have no such file. Is this file supposed to be there? Do I just make this file with the correct options? Also can I authenticate to my SMTP server from the same file? In other words... how do I get this working? :confused:

Thanks in advance for any input.

Look like your sendmail don't accept connection at all...

Try this to create new sendmail.cf...

  • have sendmail.cf installed

  • vi /etc/mail/sendmail.mc

  • by default sendmail only listen to 127.0.0.1, so comment it as
    dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

  • use m4 to generate new sendmail.cf
    # m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
    note: This will overwrite existing sendmail.cf, if needed do a backup

  • restart sendmail, check with to, it shd show sendmail accepting connection
    # ps -ef|grep -i sendmail

  • telnet to port 25 to try also...

  • test mail...
    # mail -s "Testing" youremailaddress@abc.com

If still not work, do you have any firewall blocking port 25?

Hope this will help...