Not able to connect using imap_open ()
<p>I am trying to connect and fetch messages of my hosting's email address using imap_open(), but its throwing errors.</p>

<pre><code>$server = '{mail.booksnearby.in:143/imap/ssl/novalidate-cert}INBOX';
$imap_connection = imap_open($server, $login, $password);
$mailboxinfo = imap_mailboxmsginfo($imap_connection);
$messageCount = $mailboxinfo-&gt;Nmsgs;
</code></pre>

<p>The above throws this error: <code>Array ( [0] =&gt; Retrying PLAIN authentication after [AUTHENTICATIONFAILED] Authentication failed.</code></p>

<p>If I change $server to    </p>

<pre><code>$server = '{mail.booksnearby.in:143}INBOX';   
</code></pre>

<p>then it throws the following error  </p>

<pre><code>Certificate failure for mail.booksnearby.in: self signed certificate:
</code></pre>

<p>If $server is </p>

<pre><code>$server = '{mail.booksnearby.in:143/imap/ssl/novalidate-cert}INBOX'; 
</code></pre>

<p>it throws  </p>

<pre><code>Array ( [0] =&gt; TLS/SSL failure for mail.booksnearby.in: SSL negotiation failed )
</code></pre>

<p>I can connect to the email account using an email client, with the same username password.</p>

<p>I can't seem to telnet in as well. Its running apache , cpanel and dovecat. Imap with Ssl support is enabled on my hosting..</p>
