22

and yes, I have

127.0.0.1   localhost myhost.mydomain.eu myhost.domain2.eu localhost.localdomain
127.0.1.1   myhost

in hosts file. What is wrong? Sendmail started to put this error into log.

May 9 19:08:54 myhost sm-mta[17103]: unable to qualify my own domain name (myhost) -- using short name

Is this configuration OK?

10
  • What is "this error"?
    – cuonglm
    May 9, 2013 at 17:29
  • unable to qualify my own domain name (myhost) — using short name
    – user107788
    May 9, 2013 at 17:32
  • I didn't receive this error at the beginning - It must be that I deleted something from somewhere
    – user107788
    May 9, 2013 at 17:33
  • @Gnouc however sendmail works almost entirely OK
    – user107788
    May 9, 2013 at 17:34
  • 3
    This question and its answer were exactly what I was looking for, so it should be reopened. The title states the question correctly. The body text asks whether the answer lies in modifying /etc/hosts, and if so, how. The answer makes it clear that this is indeed the case. The body text could be cleared up a little. Oct 7, 2015 at 11:00

2 Answers 2

33

Sendmail: short host name to FQDN via /etc/hosts entry

Reorder your /etc/hosts file entries:

127.0.0.1   localhost localhost.localdomain
127.0.1.1   myhost.mydomain.eu myhost.domain2.eu myhost

It should qualify myhost to myhost.mydomain.eu (the leftmost name in /etc/hosts line with myhost)

7
  • what about localhost? might be after this? why? what are the rules?
    – user107788
    May 9, 2013 at 18:19
  • @Andzrej A.Filip really this way? I have seen many configuration but not this one, can you say anything about it?
    – user107788
    May 9, 2013 at 18:31
  • this works! great. However I had changed 127.0.0.1 localhost localhost.localdomain to 127.0.0.1 localhost myhost.mydomain.eu before because my SMTP has introduced himself as localhost.localdomain : I am afraid this problem will come back now. What do you think about it?
    – user107788
    May 9, 2013 at 18:38
  • 1
    If you want to change how your SMTP server announces itself change the $j macro as described here
    – adamo
    May 9, 2013 at 18:42
  • 1
    As I understand when sendmail uses /etc/hosts file to get Fully Quallified Domain Name (FQDN) it gets leftmost name from line with the short host name.
    – AnFi
    May 9, 2013 at 18:44
0

The issue can be resolved by entering the exchange server and mail router ip and domain information in your /etc/hosts file. See below:

#######mail server

ipofexchangeserver   exchangeservername.domain.local  mailhost

ipofmailrouter       mailrouter mailrouter.domain 

Example:

172.18.18.400    sampleexvs   sampleexvs.samplegroup.com   mailhost

172.18.68.432    mailrouter   mailrouter.samplegroup.net

You must log in to answer this question.