Sendmail and hosts file.

SendMail

By default, Sendmail uses DNS to perform name resolution. However, in some circumstances, it is feasible to use the /etc/hosts file for name resolution.

To change the default behaviour, you need to use the /etc/mail/service.switch file.
For example, if you want to consult first the hosts file, followed by any DNS, you need to create the /etc/mail/service.switch file with following content:

hosts files dns
aliases files

In /etc/mail/sendmail.cf uncomment following lines:

# service switch file (name hardwired on Solaris, Ultrix, OSF/1, others)- UNCOMMENTED BY LVS
O ServiceSwitchFile=/etc/mail/service.switch

# hosts file (normally /etc/hosts) – UNCOMMENTED BY LVS
O HostsFile=/etc/hosts

Once done, rebuilt your sendmail configuration by issuing:

make -C /etc/mail

To active this change you restart your Sendmail server by issuing following command:

service sendmail restart

Changes are now active.

Leave a Reply

about my life, my work, my interests, technical stuff, ….