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 localhost locahost. 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 "[email protected]"

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 []
>>> EHLO myserver.
250-myserver. Hello localhost [], 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:<[email protected]>
>>> DATA
553 5.1.8 <[email protected]>... 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 [] 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 []
>>> QUIT
221 2.0.0 myserver. closing connection

Messages are delivered when I specify a real sender address:

echo "hello" | sendmail -vf "[email protected]" "[email protected]"

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, 2015 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. Sep 18, 2015 at 17:23

1 Answer 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: localhost localhost.local 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 Sep 18, 2015 at 22:37
  • If my domain name is “inspvirtual.mx”, could you explain me what do I need to write? I don’t quite get it, and also, do I need to restart anything? May 26, 2019 at 16:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .