Guides & TutorialsTroubleshootingEmail TroubleshootingTroubleshooting a Cannot connect to host (php_network_getaddresses: getaddrinfo failed: Name or service not known) Error

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.

Cause

The system cannot resolve the invalid or unreachable Hostname in the support department's mail importing configuration.

Solution

To resolve this issue:

  1. Go to Configuration > System Settings > Support Departments.
  2. Edit the relevant support department.
  3. Make certain that you have entered the correct mail server hostname for Hostname. Check for blank spaces and spelling mistakes.
  4. Confirm that you have entered the correct IMAP or POP port number.
  5. Click Save Changes.
  6. 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.