The problem

You want to operate a Sendmail server, and for various reasons you cannot or do not want to use Postfix, Exim or Qmail. However, your Sendmail should not deliver the mails itself, but only forward them to a smart host.

This all works, but: Your Sendmail cannot deliver mails without a working name resolution. This is especially annoying because this is actually superfluous when using a smarthost.

If you call up the undelivered mails with mailq -Ac you will see entries with deferred and hostname lookup.

The cause

The exact cause is not (exactly) known. Sendmail tries to resolve or check host or domain names at various points.

A solution

Create a file /etc/mail/service.switch with the following content:

/etc/mail/service.switch:hosts files
aliases files

Now add the following line to your code sendmail.mc:

/etc/mail/sendmail.mc:define(`confSERVICE_SWITCH_FILE',`/etc/mail/service.switch')dnl

Do not forget to rebuild the file sendmail.cf by calling make, and then restart or at least reload Sendmail.

Linux knowledge

These articles were written by the founder of Checkmk many years ago.
They are still valid though and thus we keep them on our website.
Mathias has since then developed a monitoring software called Checkmk

Find out more