Symptoms
-
There are deferred (unsent) emails in Plesk > Tools and Settings > Mail Server Settings > Mail Queue, that failed to be sent to
@example.com
address. -
The following error is shown in
/var/log/maillog
:status=deferred (Host or domain name not found. Name service error for name=example.com type=MX: Host not found, try again
-
The remote may be resolved from Plesk server:
# dig example.com +short
# dig example.com mx +short -
The remote host can be resolved from a different server:
# dig example.com +short
203.0.112.2
# dig example.com mx +short
10 mail.example.com
Cause
The server is configured to use a DNS resolver that cannot be reached or cannot resolve DNS names. Alternatively, it may be possible that there are no DNS servers configured in /etc/resolv.conf
.
Resolution
1. Connect to the server via SSH
2. Add proper resolver to /etc/resolv.conf
. For example:
# cat /etc/resolv.conf
nameserver 8.8.8.8
3. Restart postfix:
# systemctl restart postfix
Note: If in /etc/resolv.conf
there are more nameservers, please set it on top of the nameservers list. Nameservers list order matters.
Note: Sometimes, In Debian/Ubuntu OSes /etc/resolv.conf
can be managed only by system utilities and manual adjustments may not work. In this scenario, it's necessary to do some extra steps as mentioned here
Warning: Make sure that the nameservers configured in the server are reachable from the server network