Host or domain name not found. Name service error for name="XYZ" type=AAAA: Host not found Host or domain name not found. Name service error for name="XYZ" type=A: Host not found
Here XYZ is the host name of the droplet and NOT the domain name. For example if my server’s Fully Qualified Domain Name (FQDN) is “server1.vishalon.net” then the XYZ represents “server1” only.
By default, Webmin install Postfix, BIND DNS server. Within Postfix, it sets “myorigin” parameter to “/etc/mailname”. This file contains only hostname but not FQDN. You may view this settings from UI at Webmin > Servers > Postfix Mail Server > General Options > “What domain to use in outbound mail”. Instead, select “Use hostname” or “Use domainname” which internally translates to “$myhostname” (i.e. server1.vishalon.net and NOT “server1”) or “$mydomain” (i.e. vishalon.net). If you are hosting multiple sites on a single server and you want to receive emails for both the sites, I suggest to use hostname.
From the internet, I found that Postfix tries to resolve the “myorigin” name by going through DNS query. Earlier setting tried to query “server1” to the external DNS and failed so email bounced. Now as we are using FQDN, DNS query would give the correct result and hence email will be delivered.