Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IMAP problems

Status
Not open for further replies.

alfalf

Programmer
Joined
Mar 6, 2003
Messages
155
Location
BA
Hello.

In short, what's wrong with this code:

<?php
$server=&quot;pop.iskon.hr:110&quot;;
$user=&quot;alf&quot;;
$pass=&quot;********&quot;;
$conn=@imap_open(&quot;\{$server/imap}INBOX&quot;,$user,$pass) or die(&quot;Connection to server failed &quot;.imap_last_error());
$headers=@imap_headers($conn) or die(&quot;Couldn't get emails&quot;);
$numEmails=sizeof($headers);
echo &quot;You have $numEmails in your mailbox&quot;;
for ($i=1;$i<$numEmails+1;$i++)
{
$mailHeader=@imap_headerinfo($conn,$i);
$from=$mailHeader->fromaddress;
$subject=strip_tags($mailHeader->subject);
$date=$mailHeader->date;
echo &quot;Email from $from, subject $subject, date $date<br>&quot;;
}
imap_close($conn);
?>

The problem is that this code doesn't retrive anything (including no error messages). Somehow it seems that connection is ok, but then nothing happens.

Another problem is that it tooks almost minute-two to finish output of this code (returning blank page).

Is this IMAP function slow anyhow? Or the problem might be that I opened an free email account with this
Their mail server (incoming) is pop.iskon.hr and port is 110. What could cause this problem? I see on some forums that guys (girls) do expirience simmilaire stuff, but none of solutions does work for me.

Thanks for any suggestions.
 
Remove all the '@'s from your code and it will give you error messages. Then you can establish where exactly the errors are occuring.

In this line
Code:
$headers=@imap_headers($conn) or die(&quot;Couldn't get emails&quot;);

the '@' will surpress any errors so it will never show you 'Couldn't get emails' because you've told it not to.

Happy debugging.

T
 
Thanks!

Here are my messages: :))))

Warning: imap_open(): Couldn't open stream {pop.iskon.hr:110/imap} in c:\inetpub\ on line 5

Fatal error: Maximum execution time of 30 seconds exceeded in c:\inetpub\ on line 5

or (if pop. removed):

Warning: imap_open(): Couldn't open stream {iskon.hr:110/imap} in c:\inetpub\ on line 5
Connection to server failed [CLOSED] IMAP connection broken (server response)

What could be a problem? With mail.yahoo.com I receive this error mesage:

Warning: imap_open(): Couldn't open stream {mail.yahoo.com/imap}INBOX in c:\inetpub\ on line 5
Connection to server failed Can't connect to login.yahoo.akadns.net,143: Timed out (10060)

So it seems that I cannot access any of my mail accounts! Not to mention that I tried other my mailboxes (such as mail.lsinter.net, mail.globalnet.hr, etc.) and none of them responds - stream was never opened.

My phpinfo shows me IMAP version 2001.

Any other suggestions? thx.
 
Yah, why are you trying to connect through IMAP to a POP port?
 
lol, maybe he was better off surpressing the errors.
 
Id be suprised to see IMAP supported on a free server, you are probabbly better off using POP anyway.

Can you get to these mail accounts using outlook express (or other email client)?.

Try to establish if you can actualy get to the accounts before spendingtime debugging code.

Finally try to ping pop.iskon.hr is it reachable ?
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top