I just installed Red Hat 7.3 with Apache and PHP. I ran a simple script
to test the imap_open function and it doesn't work when using the values
for my server. 

http://www.gym.itesm.mx/imap.php

However, if the mailbox I request to open is on another server, it does work. 

The strange thing is that a friend of mine has the same script running on his 
server (http://pollux.icon.net.mx/~antonio/imap.php) and he can read a mailbox 
from my server as well as any other.

When I run the script on my server and try to access a local mailbox I get the
following error:

Warning: Couldn't open stream {www.gym.itesm.mx:143}INBOX in 
/home/campus/html/imap.php on line 5

I just don't know what could be wrong. Help is appreciated.

Here is the script:

<?php

function test_imap($mbx,$uid,$pwd)
{
  if (!$mbox = imap_open ($mbx, $uid, $pwd))
  {
    echo "<br /><br />";
    echo "<span style='font size: x-large;color:red;'>Password incorrecto</span>";
    echo "<br /><br />";
    echo "<pre>";
    echo "<b>Mailbox.:</b> $mbx<br />";
    echo "<b>Cuenta..:</b> $uid<br />";
    echo "<b>Password:</b> $pwd<br />";
    echo "<b>Error...:</b> "; echo imap_last_error();
    echo "</pre>";
  } else {
    echo "Password correcto: $mbx";
    imap_close($mbox);
  }
}

if (!isset($mbx1))  $mbx1 = "{www.gym.itesm.mx:143}INBOX";
if (!isset($uid1))  $uid1 = "gsoberon";
if (!isset($pwd1))  $pwd1 = "mypass";

if (isset($test)) {
  test_imap($mbx1,$uid1,$pwd1);
}

?>
<html>
  <body>
    <hr>
    <form action="imap.php" method="get">
      <p>
        mailbox: <input type=text name=mbx1 value="<?echo $mbx1;?>"><br />
        usuario: <input type=text name=uid1 value="<?echo $uid1;?>"><br />
        passwd: <input type=text name=pwd1 value="<?echo $pwd1;?>"><br />
        <br />
        <input type=submit name="test" value="Test">
      </p>
    </form>
  </body>
</html>

--
Sergio T.

Reply via email to