Re: IMAP and PHP
| From: | viva technologies | Date: | Sat, 09 Sep 2000 16:52:35 +0000 |
| Subject: | Re: IMAP and PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-15993@lists.php.net to get a copy of this message | ||
hi,
change the last 3 lines from
}
imap_close($mb);
}
?>
to
}
}
imap_close($mb);
?>
cause with your code after the first message the stream is closed
and thats the reason why you only see one
===================
"document contained no data"
if there are no emails you will recieve exactly that
so you should implement some error-handling
.... no emails
.... not able to connect
..........
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/ viva technologies
_/ gstrein andreas
"Always listen to the experts; they'll tell you what can't be done and why.
Then do it."
- Robert A. Heinlein
> I have code which looks like this (taken from a book):
> <html>
> <head>
> <title>Testabfrage POP3 Server</title>
> </head>
>
> <body>
> <?php
> $user = "myname";
> $pass = "mypasswd";
> $mb = imap_open("{mail.cs.tu-berlin.de/pop3}INBOX", $user, $pass);
>
> if ($mb)
> {
> $check = imap_check($mb);
> echo("Datum : " . $check->Date."<br>\n");
> echo("Verbindung : ".$check->Driver."<br>\n");
> echo("Mailbox : ".$check->Mailbox."<br>\n");
> echo("Anzahl Emails : ".$check->Nmsgs."<br>\n");
> echo("Aktuell : ".$check->Recent."<br>\n");
> echo("<hr>\n");
> for ($i = 1; i<= imap_num_msg($mb); $i++)
> {
> echo($i);
> $header = imap_header($mb, $i);
> echo("Datum : ".$header->date."<br>\n");
> echo("An : ".$header->to."<br>\n");
> echo("Von : ".$header->from."<br>\n");
> echo("CC : ".$header->cc."<br>\n");
> echo("Antwort : ".$header->reply_to."<br>\n");
> echo("Betreff : ".$header->subject."<br>\n");
> echo("<br>\n");
> echo("<pre>\n");
> echo(imap_body($mb, $i)."</pre>\n<hr>\n");
> }
> imap_close($mb);
> }
> ?>
> </body>
> </html>
>
> the page which is built either returns with a "document contained no
> data" error or only delivers the first message (even if there are more
> available). Now my question is whether the code is wrong (wouldn't be
> the first mistake in the book) or some other proböem exists.
> thanx for your help
> icarus
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>