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

PHP
php下载远程文件类--支持断点续传 (1)
方便实用的PHP生成静态页面类
PHP和Java强强联合 集成开发详解
实现Web 2.0 需借助开源技术力量
PHP实例:PHP上传自动生成缩略图及水印类
PHP技术:txtSQL安装手册中文版
利用PHP+JavaScript打造AJAX搜索窗
PHP利用cookie做的投票程序
PHP教程:用PHP程序对网页表单的处理
PHP应用:PHP在linxu下的安装与配置
PHP实例:PHP安全编程之加密功能
PHP技巧:关于cookie和session的分析
PHP入门:PHP网站开发中常见问题汇总
PHP教程:实现网站的无限分类
PHP技巧:用PHP控制您的浏览器cache
学习掌握动态网页PHP的编程语句
web开发中PHP+MySQL分页显示示例分析
PHP安装十大经典问题
BluePage通用分页类助开发者提高开发效率
实现强大的翻页跳转功能

PHP 中的 pop3邮件收取一例


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 123 ::
收藏到网摘: 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