Connection to IMAP server failed.

When trying to send emails from my Roundcube Webmail server I’m getting the following error:

Connection to IMAP server failed.
Server Error: Could not connect to localhost:143: php_network_getaddresses: getaddrinfo failed: System error

I can telnet to localhost 143 and receive the following:

root@webmail:/home/ubuntu# telnet localhost 143
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.

  • OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN AUTH=LOGIN] Dovecot ready.

My /etc/hosts file seems to be setup correctly.

127.0.0.1 localhost localhost.localdomain
127.0.1.1 webmail.mydomain.co.uk webmail

The following lines are desirable for IPv6 capable hosts

::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

Running out of ideas as to what it could be, any help is appreciated

Thanks

TTT

Did you get this sorted?
My hosts file is different to yours…on the second line i reference my ipaddress with host.fqdn host (substitute 192… ip address for your own of course)

127.0.0.1 localhost.localdomain localhost

192.168.0.100 server1.example.com server1

Im not using imap and mine is a webserver…not much of an expert on mail.