Neat trick to beat the sendmail FQDN check

When you install sendmail on a local machine and want to test some mail sending feature of your project, sendmail has a tendency to hang for a couple of minutes each time you try and send mail.

Looking in the /var/log/mail.log will reveal it is trying to determine the fully qualified domain name:

Sep 16 09:20:01 MyHostName sm-msp-queue[14171]: My unqualified host name (MyHostName) unknown; sleeping for retry
Sep 16 09:21:01 MyHostName sm-msp-queue[14171]: unable to qualify my own domain name (MyHostName) -- using short name

Here is a quick fix which resolves the problem:

1. Edit /etc/hosts
2. Change the record for so that it looks something like this localhost.localdomain localhost MyHostName

3. Restart sendmail

This now makes sendmail think it’s FQDN is localhost.localdomain, and mail now sends instantly!


One thought on “Neat trick to beat the sendmail FQDN check”

  1. Unfortunately, I later discovered that this method causes some issues with Samba sharing to Windows computers. I also use my test box for file sharing so had to revert this change to get the file sharing back.

Leave a Reply