Just now installed whm/cpanel, created some accounts, created mail account in one of them and entered squirrelmail to check the mail.

Unfortunately it gives me an error:

Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /usr/local/cpanel/base/3rdparty/squirrelmail/plugins/login_auth/functions.php on line 129

Warning: fsockopen() [function.fsockopen]: unable to connect to localhost:143 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /usr/local/cpanel/base/3rdparty/squirrelmail/plugins/login_auth/functions.php on line 129

How do I fix it? I don't know exactly, but I read some sites and maybe the problem in dns? I changed ns1.com to ns1.myhost.com in a Basic cPanel & WHM Setup

P.S. Im sure that it server configuration problem, not squirrelmail, other mail clients are not working too..

2 Answers 2


unable to connect to localhost:143

The above message means that SquirrelMail expects an IMAP server to listen on localhost ( or ::1) and port 143. Do you have an IMAP sever runnning? If so does it listen on port 143? If yes it may be the case that you have to make the imap server listen on (localhost) too.

Otherwise check whether your imap server listens on port 993 (secure IMAP) and configure accordingly. I configure SqurrelMail by hand by executing perl conf.pl at the config directory.

  • I checked via telnet open localhost 143 and it returned OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE STARTTLS AUTH=PLAIN AUTH=LOGIN] status. So it means that imap is here and on 143 port. But why does squrrelMail cannot connect to localhost:143?
    – Pleerock
    Commented Jun 11, 2012 at 11:23
  • That is because it seems that you've declared localhost:143 as the name of the host where in fact the name should have been plain localhost. The configuration file for SquirrelMail keeps the hostname and the port in two separate variables.
    – adamo
    Commented Jun 11, 2012 at 18:19
  • Configuration is default, after installing WHM. Not just SquirrelMail isn't working. Horde and RoundCube don't working too. Horde gives wrong username error (But username is right, I think he just handle the error as wrong username), RoundCube gives "Connection to IMAP server failed." error. Even manual connection via desktop client doesn't want to work...
    – Pleerock
    Commented Jun 11, 2012 at 18:43
  • like this problem: forums.cpanel.net/f43/connection-imap-server-failed-96021.html . IMAP is turned on..
    – Pleerock
    Commented Jun 11, 2012 at 19:00
  • If the configuration is the default, please try to change it, even if this means retyping the same stuff. Assuming that the defaults are correct is sometimes the real problem. Other than that I cannot help you since I am not using CPanel.
    – adamo
    Commented Jun 11, 2012 at 19:09

unable to connect to localhost:143

Check your DNS settings and make sure you have set up your IPs. I think problem is somewhere in your DNS server.

Not the answer you're looking for? Browse other questions tagged .