Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sendmail connection refused by 127.0.0.1 [closed]

The server that I'm on is FreeBSD and sendmail just recently stopped sending emails. I've been doing a lot of reseach on google and I've tried many things from lots of different websites, but so far nothing has worked.

Here's the output from a sendmail command:

# echo "test" | mail -v -s test [email protected]
[email protected]... Connecting to [127.0.0.1] via relay...
[email protected]... Deferred: Connection refused by [127.0.0.1]

Here's a telnet on port 25:

# telnet localhost 25
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
Trying ::1...
telnet: connect to address ::1: Connection refused
telnet: Unable to connect to remote host

Here's part of a netstat output:

tcp4       0      0 the.first.ip.address.25             *.*                    LISTEN
tcp4       0      0 the.second.ip.address.26            *.*                    LISTEN
tcp4       0      0 the.third.ip.address.25             *.*                    LISTEN
tcp4       0      0 the.fourth.ip.address.25            *.*                    LISTEN
tcp4       0      0 the.main.server.ip.address.25       *.*                    LISTEN

Some things I've tried so far:

1) changed settings /etc/hosts file
2) changed settings in the .mc file, then make, make install, service sendmail restart
3) directly changed the .cf file since changing .mc file didn't fix the problem, then "service sendmail restart"

I'm open to ideas if anyone has had this problem before or knows how to fix it.

Thanks!

like image 379
hopefulcd Avatar asked Nov 26 '14 23:11

hopefulcd


1 Answers

To check that port 25 is open try using sockstat like root, example:

sockstat -4l

Use sysrc to ensure sendmail is enabled/started on boot time:

sysrc sendmail_enable="YES"

Start/Restart by doing:

/etc/rc.d/sendmail restart

As an alternative, you may want to configure ssmpt as a replacement for sendmail, so that you can use your own provider to send emails.

like image 192
nbari Avatar answered Oct 22 '22 11:10

nbari