Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to connect using imap_open ()

Tags:

php

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.

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

like image 934
gyaani_guy Avatar asked Jul 23 '12 10:07

gyaani_guy


People also ask

Why can't I connect to my IMAP server?

IMAP validation errorConfirm the IMAP server and port settings are correct. Most IMAP ports will be 993 or 143. Verify the IMAP server meets the technical requirements for connecting an inbox via IMAP and SMTP. Your IT team might only allow certain IP addresses to access the IMAP service running on your IMAP server.


1 Answers

Are you sure that the port number is 143 (not 993)? Cause you are using a secure connection with self signed certificate as I see. Try to do that this way:

$server = '{mail.booksnearby.in:993/imap/ssl/novalidate-cert}INBOX';
like image 158
sparkle Avatar answered Nov 11 '22 19:11

sparkle