I have tried to connect to mit private as well to my google apps for work inbox via IMAP using the Horde_Imap_Client. I have used the following config:
$config = array(
'username' => $username,
'password' => $password,
'hostspec' => 'imap.gmail.com',
'port' => '993',
'secure' => true,
"debug" => "imap.log",
"debug_literal" => true
);
I also tried ssl, sslv2, sslv3 and tls for the secure value. The Exception i got was Error when communicating with the mail server.
and the imap.log only showed me this
------------------------------
>> Thu, 28 Jan 2016 18:29:14 +0100
>> Connection to: imap://imap.gmail.com:993/
>> Server connection took 0.0156 seconds.
>> Slow Command: 10.018 seconds
>> ERROR: read/timeout error.
------------------------------
I also tried allowing "insecure apps" in my google account but the result was the same. Any clues? The connection works fine with our in-house IMAP server and the office365 IMAP server