Page 1 of 1

Failed to open socket #0.

Posted: Mon Jun 05, 2017 9:26 pm
by bertii
Hi everyone,

I'm getting problems using GO when trying to connect to GSuite's IMAP services. This came about after an upgrade of the OS from Ubuntu 14.04 to 16.04.

Whenever I try to establish a connection to imap.gmail.com on SSL, I get the error message:
"Failed to open socket #0."

I happen to have a second account I use for testing which doesn't use Gmail, and (rather scarily) doesn't force SSL. This works fine, doesn't error, and I can view and process email as normal.

Because Gmail force SSL for all of their mail connections, I obviously cannot disable SSL for my actual email account. At first I thought it might be the IMAP settings with PHP, but these show the following in phpinfo:

Code: Select all

[b]PHP Version 5.6.30-11+deb.sury.org~xenial+3[/b]
[b]imap[/b]
IMAP c-Client Version    2007f
SSL Support    enabled
Kerberos Support    enabled


So that all looks good to me.

Next I thought, perhaps there's some verification issues or the ports are blocked on my firewall. So I borrowed an example PHP IMAP file from https://stackoverflow.com/questions/1274911/connecting-to-gmail-through-imap-with-php-ssl-context-failed. That was able to connect to my gmail account without any problems, using SSL and using either cert verification or no cert verification. So that rules out completely my PHP, Apache, firewall, and Gmail. The problem seems to be with GO.

I noticed that there's a key.txt file written to the root of the /home/groupoffice directory, this does get created and populates with a short key.

There's no other errors with GO debug logging enabled:

Code: Select all

Firing listener: email::check_mail
imap::connect(imap.gmail.com, 993, office@??????????.com, ***, 1, 0)
Failed to open socket #0.


What am I missing? What else can I check?

Many thanks,
Bertii