With a “Host not found, try again.” it could mean that your server is having DNS resolution issues, or Postfix itself is having DNS resolution issues. But that is the core of what has to be cleaned up.
As for how to clear it up, your question doesn’t provide enough details on your base OS or setup to give a succinct answer. You seem to be running Ubuntu/Debian if you are running
sudo service postfix restart, but what other details can you provide?
Possibly connected to
resolv.conf mysteriously disappearing.
Based on the error:
Host or domain name not found. Name service error for
name=smtp.gmail.com type=A: Host not found, try again.
It seems like you are using Gmail’s SMTP servers for outgoing mail. Unsure what your base OS is, but based on this answer on Ubuntu Forums this seems to be an issue with a missing
resolv.conf on reboot; bold emphasis is mine:
I have the same problem on Ubuntu 14.04 LTS. When postfix is installed
but for some reason after a reboot/restart the file is not copied and
you get the blank file with only the header.
The suggested temporary solution is to copy the main OS
resolv.conf to Postfix’s directory:
sudo cp /etc/resolv.conf /var/spool/postfix/etc/resolv.conf
This isn’t a permanent fix it seems but at least it’s something to check out.
Possibly connected to
Also this answer on Server Fault explains a similar situation which focuses on IPv6 support. Pretty sure your issue is not IPv6-related since the error is about a “type=A” record which is IPv4 and for IPv6 it would be “type=AAAA.” But that said, it might worth experimenting with adjusting the
inet_protocols setting in your Postfix config file. Here is what the official Postfix documentation explains:
When IPv4 support is enabled via the inet_protocols parameter, Postfix
will look up DNS type A records, and will convert IPv4-in-IPv6 client
IP addresses (::ffff:188.8.131.52) to their original IPv4 form (184.108.40.206).
The latter is needed on hosts that pre-date IPV6_V6ONLY support (RFC
When IPv6 support is enabled via the inet_protocols parameter, Postfix
will do DNS type AAAA record lookups.
When both IPv4 and IPv6 support are enabled, the Postfix SMTP client
will choose the protocol as specified with the smtp_address_preference
parameter. Postfix versions before 2.8 attempt to connect via IPv6
before attempting to use IPv4.
- inet_protocols = ipv4
- inet_protocols = all (DEFAULT)
- inet_protocols = ipv6
- inet_protocols = ipv4, ipv6
Assuming you are on an Ubuntu/Debian setup open up the config here:
sudo nano /etc/postfix/main.cf
And find—or set the value—to the
inet_protocols line to be either this:
inet_protocols = ipv4
Or be this:
inet_protocols = all
Then restart the Postfix service—or the whole server—and see if that clears things up:
sudo service postfix restart