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

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

The above throws this error: Array ( [0] => Retrying PLAIN authentication after [AUTHENTICATIONFAILED] Authentication failed.

If I change $server to

$server = '{mail.booksnearby.in:143}INBOX';

then it throws the following error
Certificate failure for mail.booksnearby.in: self signed certificate:

If $server is

$server = '{mail.booksnearby.in:143/imap/ssl/novalidate-cert}INBOX';
 it throws
 Array ( [0] => TLS/SSL failure for mail.booksnearby.in: SSL negotiation failed )

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

Help!

Thanks

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

This is a complete shot in the dark, but seeing as you've had no other replies, I'll post it anyway.

This post references the solution for self-signed certficates as being:

$server = '{mail.booksnearby.in:143/novalidate-cert}INBOX';

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.