Configure Sendmail on FreeBSD to only accept local mail for hostnames in /etc/mail/local-host-names
I just want to have a local mailer daemon for command-line mail which only accepts mail for “localhost” and nothing else.
The problem is that in the default configuration Sendmail probes all available network interfaces and thinks it is responsible for any hostname and IP addresses who are configured on them. This may not be the case.
On FreeBSD one can create a file named
/etc/mail/local-host-names. This is where the desired host names go (line-by-line) where Sendmail is responsible for. But without disabling the interface probing, those hostnames will just get added additionally. We need to disable the probing by adding the following line to
/etc/mail/freebsd.mc (or your custom mc-file, if you use one):
Now, use the following line to build the config and restart Sendmail:
make all install restart
Thats it. Sendmail should now only process mail for the hostnames listed in
You can verify Sendmails authoritative hostnames by running
sendmail -bt and typing
$=w at the prompt (exit with Ctrl+D).
For the sake of completeness:
Disable Sendmails incoming mail-service (listening on external interfaces) (
Completely disable Sendmail (
sendmail_enable="NO" sendmail_submit_enable="NO" sendmail_outbound_enable="NO" sendmail_msp_queue_enable="NO"
Be aware that completely disabling Sendmail without installing an alternate MTA is not optimal as for example mails from periodic(8) won’t come through anymore.