• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

sendmail: Cannot open mail:25

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

su root

Senior Member, --, I teach people how to read your
Joined
Aug 25, 2001
Location
Ontario, Canada
I know I've solved this before, but I just don't remember how.

/usr/sbin/sendmail is linked to ssmtp, and any time I try to send an email with it, it just fires up this message:

sendmail: Cannot open mail:25

I have two boxes with relatively similar configs, one works, one doesn't. Just tried remerging it, with no change.

Linux 2.4.20-gentoo-r6 #2 i586 Pentium MMX GenuineIntel GNU/Linux
 

injinj

Member
Joined
Dec 12, 2003
Location
San Francisco
netstat -l should show:

Proto Recv-Q Send-Q Local Address Foreign Address State
...
tcp 0 0 *:smtp *:* LISTEN
...

If not, there is no smtp server running. I'd guess that sendmail is bailing when the machine boots.
 
OP
su root

su root

Senior Member, --, I teach people how to read your
Joined
Aug 25, 2001
Location
Ontario, Canada
Thanks for the reply.

however, this server isn't running a sendmail daemon, it's running ssmtp, which is a simple, localhost-only outgoing-only smtp engine.

I'm trying to send email across the internet (which works perfectly fine on my other linux box, which apparently has the same configuration in /etc/ssmtp/ssmtp.conf).
 
OP
su root

su root

Senior Member, --, I teach people how to read your
Joined
Aug 25, 2001
Location
Ontario, Canada
I tried running it as root, gave the same error, so it's not a permissions problem. Could still be a misconfiguration.

strace doesn't show anything, as far as I can read it, here it is (the important parts, anyway).
 

injinj

Member
Joined
Dec 12, 2003
Location
San Francisco
su root said:
I tried running it as root, gave the same error, so it's not a permissions problem. Could still be a misconfiguration.

strace doesn't show anything, as far as I can read it, here it is (the important parts, anyway).

Looks like it's failing because of a DNS lookup for "mail" at 10.10.220.1. I'm not sure how the ssmtp protocol works. It may be that setting "mail" to 127.0.0.1 in /etc/hosts will do it.
 
OP
su root

su root

Senior Member, --, I teach people how to read your
Joined
Aug 25, 2001
Location
Ontario, Canada
I was sending to an address @mail.com
There is nothing besides loopback in hosts
10.10.220.1 is my router box / dns cache (functioning properly, afaik)

I've tried with other email addresses, they all fail. Tried putting a "mail" to localhost entry in hosts, no effect.

AFAIK, ssmtp is basically a very cutback version of sendmail. Someone just grabbed an axe, and hacked out all the bits that would make it insecure, leaving an outgoing-only, localhost-only SMTP engine, which should allow outgoing messages.
 
OP
su root

su root

Senior Member, --, I teach people how to read your
Joined
Aug 25, 2001
Location
Ontario, Canada
got it working.

the "mailhub" config property wasn't working.
for some reason, my gateway box was resolving "mail" properly for itself, but wasn't resolving it for others to use. :eh?:

Oh well, it's working now.. thanks :)