test_pop3.php(做為現在的主流開發語言)
<HTML>
<HEAD>
<TITLE>Test for Manuel Lemoss php(做為現在的主流開發語言) POP3 class</TITLE>
</HEAD>
<BODY>
<?
require("pop3.php(做為現在的主流開發語言)");
$user="user";
$password="passwd";
$apop=0;
$pop3_connection=new pop3_class;
$pop3_connection->hostname="mail.xiaocui.com";
if(($error=$pop3_connection->Open())=="")
{
echo "<PRE>Connected to the POP3 server "$pop3_connection->hostname".</PRE>
";
if(($error=$pop3_connection->Login($user,$password,$apop))=="")
{
echo "<PRE>User "$user" logged in.</PRE>
";
if(($error=$pop3_connection->Statistics(&$messages,&$size))=="")
{
echo "<PRE>There are <b>$messages</b> messages in the mail box with a total of <b>$size</b> bytes.</PRE>
";
$result=$pop3_connection->ListMessages("",0);
if(GetType($result)=="array")
{
for(Reset($result),$message=0;$message<count($result);Next($result),$message++)
echo "<PRE>Message ",Key($result)," - ",$result[Key($result)]," bytes.</PRE>
";
if($messages>0)
{
if(($error=$pop3_connection->RetrieveMessage(1,&$headers,&$body,-1))=="")
{
echo "<PRE>Message 1:
---Message headers starts below---</PRE>
";
for($line=0;$line<count($headers);$line++)
echo "<PRE>",HtmlSpecialChars($headers[$line]),"</PRE>
";
echo "<PRE>---Message headers ends above---
---Message body starts below---</PRE>
";
for($line=0;$line<count($body);$line++)
echo "<PRE>",HtmlSpecialChars($body[$line]),"</PRE>
";