Recently I attempted to get sendmail to work between two machines in my internal test network. Since it's my own small network I tend to use short unqualified hostnames such as "grey" or "white". As you may know this presents certain challenges when working with sendmail since sendmail prefers FQDNs (fully qualified domain names). In this blog entry I'll talk about what those challenges are and what I think is the most straight forward way to get sendmail to work in such a network.
On Fedora 10 if you choose a short hostname such as "grey" at install time the relevant entry in /etc/hosts ends up looking like the following:
127.0.0.1 localhost.localdomain localhost grey
You'll find that if you don't alter either /etc/hosts or /etc/mail/sendmail.mc that each sendmail server will think it's hostname is "localhost.localdomin". This results in errors such as "Real domain name required for sender address" when the receiving sendmail server is told that the email comes from "localhost.localdomin".
Additionally if the name found does not have a "." in it sendmail iterates through the aliases (the tokens following the first token in /etc/hosts) until it finds an alias that has a ".". If sendmail is still not able to find a name with a "." (if, for example, "localhost.localdomain" had been removed from the above) it waits 60 seconds and tries again. This results in vary slow boot times with messages such as the following:
Mar 6 11:50:49 localhost sendmail: My unqualified host name (grey) unknown; sleeping for retry
One approach is to simply set the domain name explicitly in in /etc/mail/sendmail.mc like this:
Alternatively, if you prefer to not hardcode the hostname in files where it currently is not you can try to make up a top level domain and put it in /etc/hosts prior to any other FQDNs; something like this:
127.0.0.1 localhost grey.my_domain localhost.localdomain grey