当前位置:编程学习 > php >>

pop3邮件收取一例

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> ";
补充:Web开发 , php ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,