Page 1 of 1

imap_open too long to authenticate: can we improve it?

Posted: Tue Aug 05, 2008 4:21 pm
by JAB Creations
PHP's imap module/map_open function is taking way too long to authenticate, maybe for about a dozen seconds the browser hangs and I'm not sure what is going on at the serverside. The code works all fine and dandy and I switched from connecting to mail.jabcreations.com to localhost and did not see any noticeable improvement in the response time. Is this normal? Does anyone know how I can speed authentication up?

I'm pretty far in to development right now so this code is not considered final.

Code: Select all

if ($_POST['formis'] == 'signin')
{
 $user = $_POST['username'].'@jabcreations.com';
 $pass = $_POST['password'];
 
 $mbox = imap_open("{localhost:143/notls}", $user, $pass);
 if (!$mbox) {$_SESSION['error'] = "Unable to connect authenticate?"; header("location:mail.php?error1");}
 else
 {
  $_SESSION['member'] = $_POST['username'];
  $_SESSION['mail'] = $_POST['username'].'@jabcreations.com';
  $_SESSION['pass'] = $_POST['pass'];
  header("location:mail.php");
 }
}
else if (isset($_SESSION['member']))
{
 $mail = $_SESSION['mail'];
 $pass = $_SESSION['pass'];
 $mbox = imap_open("{localhost:143/notls}", $_SESSION['mail'], $_SESSION['pass']);
 if (!$mbox) {$_SESSION['error'] = "Unable to connect authenticate?"; header("location:mail.php?error2");}
}