1

On my server, sendmail was taking 60s to send a simple message. After some googling, I found out that it was due to a DNS problem. I had this log:

Sep 13 08:00:01 myserver sm-msp-queue[1493]: My unqualified host name (myserver) unknown; sleeping for retry
Sep 13 08:01:01 myserver sm-msp-queue[1493]: unable to qualify my own domain name (myserver) -- using short name

The solution was to edit /etc/hosts and add names with a dot at the end

127.0.0.1 localhost locahost.
127.0.0.1 myserver myserver.

Now sendmail runs very quickly, but the messages as not delivered anymore. I'm sending just a "hello" to my gmail account.

echo "hello" | sendmail -v "xxx@gmail.com"

I've seen some people saying that the remote server may reject messages, but I don't understand, because they were being delivered before altering the hosts file. I don't want to host a mail server. I just need to send messages to myself. Here's the output from the command line above:

220 myserver. ESMTP Sendmail 8.14.4/8.14.4/Debian-4.1ubuntu1; Fri, 18 Sep 2015 13:50:45 -0300; (No UCE/UBE) logging access from: localhost(OK)-localhost [127.0.0.1]
>>> EHLO myserver.
250-myserver. Hello localhost [127.0.0.1], pleased to meet you
...
250 2.0.0 Verbose mode
>>> MAIL From:<www-data@myserver> SIZE=3 AUTH=www-data@myserver
250 2.1.0 <www-data@myserver>... Sender ok
>>> RCPT To:<xxx@gmail.com>
>>> DATA
553 5.1.8 <xxx@gmail.com>... Domain of sender address www-data@myserver does not exist
503 5.0.0 Need RCPT (recipient)
>>> RSET
250 2.0.0 Reset state
>>> RSET
250 2.0.0 Reset state
www-data@myserver... Using cached ESMTP connection to [127.0.0.1] via relay...
>>> MAIL From:<> SIZE=1027
250 2.1.0 <>... Sender ok
>>> RCPT To:<www-data@myserver>
>>> DATA
250 2.1.5 <www-data@myserver>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
050 <www-data@myserver>... Connecting to local...
050 <www-data@myserver>... Sent
250 2.0.0 t8IGojKw022539 Message accepted for delivery
www-data@myserver... Sent (t8IGojKw022539 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 myserver. closing connection

Messages are delivered when I specify a real sender address:

echo "hello" | sendmail -vf "sender@realdomain.com" "xxx@gmail.com"

But why messages were delivered when it couldn't resolve it's own name, and not now?

  • Post the configuration (in particular the output of sendmail -d0.1 </dev/null) with /etc/hosts reverted to the previous contents. Remote mail servers will rightly reject anything from the unqualified name of myserver.; this must be qualified to myserver.example.com or such. – thrig Sep 18 '15 at 17:20
  • 1
    Don't send to port 25 from a broken mail server. Read support.google.com/a/answer/176600?hl=en and send using authentication, which ensures Gmail knows who you are regardless of the configuration of your server. I could tell you how to do that with exim4 but I have forgotten everything I once knew about sendmail configuration, sorry. Note that if you are only sending to gmail addresses you don't even need to authenticate for the aspmx.l.google.com delivery host. – roaima Sep 18 '15 at 17:23
1

Ok. I hate when it happens. I just found the solution after posting it. @thrig is right. It must be a fully qualified name. I've changed my "hosts" file to:

127.0.0.1 localhost localhost.local
127.0.0.1 myserver myserver.local

Now it works fine. Thank you all.

  • Thank you for letting us know. Please accept your own answer - this stops StackExchange from bringing your post back to the front of the list every few weeks – roaima Sep 18 '15 at 22:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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