Jump to content

pop3 fun - imap_open sometimes works


thetxt

Recommended Posts

Hey! First off I would like to say that I resort to posting on a forum for help when I am at a complete loss...

 

I have been using the same script for almost a year to check pop3 mails for user accounts on my server. It hasnt worked well since I first wrote it.

Sometimes it connects and gets the mails fine but a lot of times it just hangs. It doesnt timeout or anything..it just hangs and the page keeps trying to load. Actually, if I want to use my site anymore, I have to restart the browser.

 

here is the code i use to connect:

 

$mbox_open = "{" . $server . ":110/pop3}INBOX"; 
$mbox = imap_open($mbox_open, $user, $password); 

 

...where $server = mail.mysite.com

 

My server is running php4.

 

Is there a better/faster way to connect?

If nothing else is there a way I can set it to timeout at least and retry?

 

Thank you all for your help

 

 

chris

Link to comment
https://forums.phpfreaks.com/topic/52069-pop3-fun-imap_open-sometimes-works/
Share on other sites

Sorry I've never even heard of this function until now.  Crazy how many cool functions are built into php.  Here's what I would do first in your situation.  Change the max execution time in your php.ini file to something reasonable that way you will get a timeout error instead of having to close your browser when this thing hangs.

 

Next try running the function without using the variables.  Like they are doing in some of the examples here: http://us2.php.net/manual/en/function.imap-open.php

Thank you for your reply!

I have read the php manual on impa_open and found no help there =/

 

As you suggested, I hardcoded the server into the function. Unfortunately I still have the same issues. The username and password will have to be variables obviously.

 

Any and all suggestions are welcome. This is driving me insane!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.