Troubleshooting a Cannot connect to host (php_network_getaddresses: getaddrinfo failed: Name or service not known) Error
Symptom
Admins may see a POP3 Connection Error report email stating that one or more POP3 connections failed:
Error: cannot connect to host ; error = stream_socket_client(): unable to connect to tls://mail.example.com:143 (php_network_getaddresses: getaddrinfo failed: Name or service not known) (errno = 0 )
When you test the connection in the Email Importing settings, the test is unsuccessful.
If the connection test is successful, see Troubleshooting a Cannot connect to host (php_network_getaddresses: getaddrinfo failed: Name or service not known) Error.
Cause
The system cannot resolve the invalid or unreachable Hostname in the support department's mail importing configuration.
Solution
To resolve this issue:
- Go to Configuration > System Settings > Support Departments.
- Edit the relevant support department.
- Make certain that you have entered the correct mail server hostname for Hostname. Check for blank spaces and spelling mistakes.
- Confirm that you have entered the correct IMAP or POP port number.
- Click Save Changes.
- Confirm that you can reach the mail server through your server's command line. For example:
telnet mail.example.com 995
In this example, success could return the following result:
telnet mail.example.com 995
Trying 142.250.138.108...
Connected to mail.example.com.
Escape character is '^]'.
The following response may indicate that your server cannot resolve the hostname:
telnet mail.example.com 995
Server lookup failure: mail.example.com:995, nodename nor servname provided, or not known
This could indicate a DNS misconfiguration on your server.
The following response may indicate that your server cannot connect to the hostname:
telnet mail.example.com 995
Trying 104.21.6.156...
Connection failed: Operation timed out
This could indicate that the mail server is currently unavailable or a firewall configuration is blocking the connection.
Contact your system administrator or network provider with these test results to investigate and resolve the connectivity issue.