I know a lot of others have had this problem, but I've tried everything I've read, and I'm getting absolutely nowhere!

The code is:

$mbox = imap_open('127.0.0.1:143', $SERVER['PHP_AUTH_USER'], $SERVER['PHP_AUTH_PW']);

I've tried different variations of the first bit (as taken from the php manual), and the username and password are correct.

I get

Warning: Couldn't open stream 127.0.0.1:143 in /var/www/html/mail/index.php on line 8

According to phpinfo(), imap appears to be there

'--with-imap=shared' '--with-imap-ssl'

I'd really like to get this working, rather than my first idea of reading the /var/spool/mail/$user file!

I'm using Redhat 8.0 with an RPM of the latest version of PHP.

Any ideas? :-\

    works now!

    $mbox = imap_open('{127.0.0.1:143/notls}', $SERVER['PHP_AUTH_USER'], $SERVER['PHP_AUTH_PW']) or die('Could not connect to IMAP server.');

    Not sure what the /notls means (can't find it in the manual!), but I copied it from a comment in the manual, and it works fine :o)

      5 years later
      DannyTuppeny wrote:

      works now!

      $mbox = imap_open('{127.0.0.1:143/notls}', $SERVER['PHP_AUTH_USER'], $SERVER['PHP_AUTH_PW']) or die('Could not connect to IMAP server.');

      Not sure what the /notls means (can't find it in the manual!), but I copied it from a comment in the manual, and it works fine :o)

      THANK YOU! That saved me ripping my hair out after moving from Apache 1.2 to 2.2 with a PHP 5.2.4 recompile. And thanks to Google for find your post!

        Write a Reply...