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

PHP
使用 PHP 和 Oracle 开发企业应用程序
可扩展 可伸缩的 Oracle 与 PHP
Andi Gutmans看 PHP 5、Oracle 的未来
PEAR版本号说明
PEAR的安装
PHP 新手总结的 PHP 基础知识
WAP 与 PHP 程序设计之基础篇
PHP强制对象类型之instanceof操作符(1)
PHP强制对象类型之instanceof操作符(2)
PHP强制对象类型之instanceof操作符(3)
Linux平台wacom产品使用指南
一个嵌入式Linux系统的键盘驱动实现 (1)(2)
一个嵌入式Linux系统的键盘驱动实现 (1)
SWT的可视化控件的X11窗口句柄简介
Linux系统内核中的Device Mapper机制 (1)(5)
Linux系统内核中的Device Mapper机制 (1)(4)
Linux系统内核中的Device Mapper机制 (1)(3)
Linux系统内核中的Device Mapper机制 (1)(2)
Linux系统内核中的Device Mapper机制 (1)
又一关于apache和mysql组合的问题 - PHPchina

PHP 中的 pop3邮件收取一例


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