By default, Sendmail uses DNS for name resolution, not the /etc/hosts file. The behaviour can be changed using one of the below methods:
- If you wish to query the hosts file before DNS servers, create a /etc/mail/service.switch file which contains the following line:
hosts files dns
If you wish to query ONLY the hosts file, use the following:
Send Sendmail a HUP signal:
kill -HUP `head -1 /var/run/sendmail.pid`
and the changes will take effect.
- Open (or create if it doesn’t exist the file /etc/mail/mailertable) and add:
hostname-thats-not-working.com esmtp:[ip.addr.addr.addr]Then rebuild mailertable running:
makemap hash /etc/mail/mailertable < /etc/mail/mailertableThis should take immediate effect – no need to alter the running process.
Jobs a gooden!
If you then wish to force any deferred mail currently in the queue you can use:
sendmail -OTimeout.hoststatus=0m -q -vThis ensures that the cached DNS is ignored, and the new IP address is looked up.