Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm just trying to send myself an e-mail. On on Ubuntu using sendmail. For some reason, it doesn't work. Here's the command I'm running and what shows up when I run it:

jason@ve:~$ echo "Subject: test" | /usr/lib/sendmail -v jason@woollymammothlabs.com
jason@woollymammothlabs.com... Connecting to [127.0.0.1] via relay...
220 ve.5wrvhfxg.vesrv.com ESMTP Sendmail 8.14.3/8.14.3/Debian-9.1ubuntu1; Wed, 29 Dec 2010 13:51:49 -0800; (No UCE/UBE) logging access from: localhost.localdomain(OK)-localhost.localdomain [127.0.0.1]
>>> EHLO ve.5wrvhfxg.vesrv.com
250-ve.5wrvhfxg.vesrv.com Hello localhost.localdomain [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-EXPN
250-VERB
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
>>> VERB
250 2.0.0 Verbose mode
>>> MAIL From:<jason@ve.5wrvhfxg.vesrv.com> SIZE=14
250 2.1.0 <jason@ve.5wrvhfxg.vesrv.com>... Sender ok
>>> RCPT To:<jason@woollymammothlabs.com>
>>> DATA
250 2.1.5 <jason@woollymammothlabs.com>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
050 <jason@woollymammothlabs.com>... Connecting to 205.186.165.157. via esmtp...
050 <jason@woollymammothlabs.com>... Deferred: Connection refused by 205.186.165.157.
250 2.0.0 oBTLpnEj012261 Message accepted for delivery
jason@woollymammothlabs.com... Sent (oBTLpnEj012261 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 ve.5wrvhfxg.vesrv.com closing connection

It seems to me that the "Connection refused by 205.186.165.157" part is where things are going wrong, but I have no idea where or how to begin troubleshooting. Any advice?

$ grep 127.0.0.1 /etc/mail/sendmail.cf
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
R<@> < $* @ [127.0.0.1] >
                        $: < ? $&{client_name} > < $1 @ [127.0.0.1] >
R127.0.0.1              $@ RELAY                originated locally
# DAEMON_OPTIONS(`Family=inet,  Name=MTA-v4, Port=smtp, Addr=127.0.0.1')dnl
# DAEMON_OPTIONS(`Family=inet,  Name=MSP-v4, Port=submission, M=Ea, Addr=127.0.0.1')dnl
share|improve this question
    
Is your mail server hosted on the same machine? If so, it should be a local delivery and not extending to the 205.x.x.x address. –  ewwhite Dec 29 '10 at 22:08

2 Answers 2

Looks like you don't have port 25 open in your firewall rules. Here is what I see open

PORT     STATE    SERVICE
22/tcp   open     ssh
80/tcp   open     http
3306/tcp open     mysql

Looks like the default sendmail config on Ubuntu is to just listen on localhost. Edit the following line in your /etc/mail/sendmail.mc

DAEMON_OPTIONS(`Family=inet,  Name=MTA-v4, Port=smtp, Addr=127.0.0.1')dnl

to

DAEMON_OPTIONS(`Family=inet,  Name=MTA-v4, Port=smtp, Addr=0.0.0.0')dnl

and run make in /etc/mail and then run /etc/init.d/sendmail reload. Once this is done you can confirm that sendmail is listening on all addresses using

netstat -tnlp

As a note, in modern distributions, you should not be editing your sendmail.cf file by hand. That way lies madness.

share|improve this answer

I just wrote a complete lengthy response based on my failure to realise that the host you're doing this from, ve.5wrvhfxg.vesrv.com, is also 205.186.165.157, the primary MX for woollymammothlabs.com.

For what it's worth, if what you're really complaining about is your mail server's inability to receive mail, couching this in a question about your inability to send email probably isn't the best way to get a result.

It is likely that your issue is that your mailserver isn't listening on port 25, at least not on the external interface. Could you do a grep 127.0.0.1 /etc/mail/sendmail.cf and let us know the results?

Edit: since you've done that, it's now clear that your sendmail is configured to listen only on 127.0.0.1, and you need to fix that. slillibri is right, you don't want to edit sendmail.cf by hand if you can avoid it, which means going into /etc/mail and editing the relevant line out of sendmail.mc. I can't speak for ubuntu, but on Fedora/CentOS, this usually means changing the line

DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

to

dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')

please note that putting a # at the beginning of the line does NOT comment out a line in an m4 file such as this; you must prepend dnl to comment the line out. Then regenerate the file with make sendmail.cf and restart with service sendmail restart. The procedure on ubuntu is likely to be similar.

Once this is done, do a netstat -apn|grep -w 25 and look for something like

tcp        0      0 0.0.0.0:25                0.0.0.0:*                   LISTEN      2012/sendmail: acce 

The important bit is 0.0.0.0:25, which means sendmail is listening on all interfaces; if it still says 127.0.0.1:25 you've still got the problem.

share|improve this answer
    
I've updated my original post with that output. How do I make my mailserver listen on port 25? –  Jason Swett Dec 30 '10 at 19:21
    
See my edits above. –  MadHatter Jan 5 '11 at 6:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.