imap_open too long to authenticate: can we improve it?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

imap_open too long to authenticate: can we improve it?

Post 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");}
}
Post Reply