Postfix - Name service error for name=mailrelay.cool.com type=MX: Host not found
The following postfix error occurs in /var/log/mail after attempting to send a mail.
node01 postfix/master: reload configuration node01 postfix/pickup: 9D7A419DC: uid=0 from=
node01 postfix/cleanup: 9D7A419DC: message-id=<4D079A0B.mailJV011XXAU@node01.cool.com> node01 postfix/qmgr: 9D7A419DC: from=<firstname.lastname@example.org>, size=451, nrcpt=1 (queue active) node01 postfix/smtp: 9D7A419DC: to=<email@example.com>, relay=none, delay=0, status=deferred (Host or domain name not found. Name service error for name=mailrelay.cool.com type=MX: Host not found, try again)
/etc/postfix/main.cf had the correct relayhost entry for the mail server such as
relayhost = mailrelay.goodcompany.com
However DNS was not configured on the mail client as there was no DNS server configured on the network and therefore the mail client was using /etc/hosts for name resolution.
The errors were caused by the following line in main.cf
disable_dns_lookups = no
Change this setting to yes and reload the configuration by using the following command
Now try to send a mail, it should hopefully reach its destination now, or at least the above errors should have gone.