当前位置: 首页 > 图文教程 > 网络编程 > PHP > pop3邮件收取一例

PHP
第十一节--重载
第十二节--类的自动加载
第十三节--对象串行化
第十四节--命名空间
第十五节--Zend引擎的发展
一个好用的分页函数
一个MYSQL操作类
Apache2 httpd.conf 中文版
PHP4和PHP5共存于一系统
一些关于PHP的知识
Windows下的PHP5.0详解
Win2003下APACHE+PHP5+MYSQL4+PHPMYADMIN 的简易安装配置
Windows中安装Apache2和PHP4权威指南
PHP5新特性: 更加面向对象化的PHP
PHP初学入门
smarty实例教程
php+mysql实现无限级分类 | 树型显示分类关系
PHP的面试题集
echo(),print(),print_r()之间的区别?
PHP的面试题集,附我的答案和分析(一)

PHP 中的 pop3邮件收取一例


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 212 ::
收藏到网摘: n/a

  test_pop3.php

<HTML>
<HEAD>
<TITLE>Test for Manuel Lemos's 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 &quot;$pop3_connection->hostname&quot;.</PRE>\n";
   if(($error=$pop3_connection->Login($user,$password,$apop))=="")
   {
      echo "<PRE>User &quot;$user&quot; logged in.</PRE>\n";
      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>\n";
         $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>\n";
             if($messages>0)
            {
                if(($error=$pop3_connection->RetrieveMessage(1,&$headers,&$body,-1))=="")
                {
                  echo "<PRE>Message 1:\n---Message headers starts below---</PRE>\n";
                  for($line=0;$line<count($headers);$line++)
                     echo "<PRE>",HtmlSpecialChars($headers[$line]),"</PRE>\n";
                  echo "<PRE>---Message headers ends above---\n---Message body starts below---</PRE>\n";
                  for($line=0;$line<count($body);$line++)
                     echo "<PRE>",HtmlSpecialChars($body[$line]),"</PRE>\n";
                  echo "<PRE>---Message body ends above---</PRE>\n";
                     
                  }
               }
            &nbs