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

PHP
用PHP生成html分页列表的代码
php中的session完全教程
PHP session常见问题集锦及解决办法总结
PHP 中dirname(_file_)讲解
PHP_MySQL教程-第一天
PHP_MySQL教程-第二天while循环与数据库操作
PHP_MySQL教程-第三天 基本函数
一篇不错的PHP基础学习笔记
PHP5中的this,self和parent关键字详解教程
phpMyAdmin 安装教程全攻略
PHP入门速成教程
php之字符串变相相减的代码
php中的实现trim函数代码
IIS6的PHP最佳配置方法
简单介绍下 PHP5 中引入的 MYSQLI的用途
php分页示例代码
生成静态页面的php函数,php爱好者站推荐
隐藏你的.php文件的实现方法
推荐一篇入门级的Class文章
PHP配置文件中最常用四个ini函数

PHP 中的 pop3邮件收取一例


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