快精灵印艺坊 您身边的文印专家
广州名片 深圳名片 会员卡 贵宾卡 印刷 设计教程
产品展示 在线订购 会员中心 产品模板 设计指南 在线编辑
 首页 名片设计   CorelDRAW   Illustrator   AuotoCAD   Painter   其他软件   Photoshop   Fireworks   Flash  

 » 彩色名片
 » PVC卡
 » 彩色磁性卡
 » 彩页/画册
 » 个性印务
 » 彩色不干胶
 » 明信片
   » 明信片
   » 彩色书签
   » 门挂
 » 其他产品与服务
   » 创业锦囊
   » 办公用品
     » 信封、信纸
     » 便签纸、斜面纸砖
     » 无碳复印纸
   » 海报
   » 大篇幅印刷
     » KT板
     » 海报
     » 横幅

pop mail 类 很简朴的功能(自家用)

<?php

class popMail
{
 var $user=\\'sanshi0815@tom.com\\';
 var $pwd=\\'1234\\';
 var $popFp;
 var $msg;
 var $welcome  = \\'欢迎使用叁石pop 接收邮件!\\';
 function popMail($popHost=\\'pop.tom.com\\',$popPort=110)
 {
  $this->msg = array();
  $this->msg[] = $this->welcome;
  if ( $this->openPop($popHost,$popPort))
  {
   $this->msg[] = \\'pop server connect success!\\';
  }else{
   print_r( $this->msg );
  }
 }
 function checkCommon($com,$msg)
 {
  echo $cod = empty($com)? $this->getServerMsg() : $this->putServerMsg( $com );
  $this->msg[] = ereg( "^+OK" ,$cod )? $msg : $com .\\' exec is fauiler!error:\\'.$cod ;
  if( !ereg( "^+OK" ,$cod ) )
  {
   echo $cod;
   print_r($this->msg);
   $this->closeStmp();
   exit(0);
  }
 }
 function init()
 {
  $greeting=\\'\\';
  $rn=\\'rn\\';
  //$this->checkCommon(\\'\\',"connect");
  //echo $this->putServerMsg("APOP ".$this->user ." ".$this->pwd.$rn);
  // $this->checkCommon("USER ",\\'user\\');
  echo $this->putServerMsg("USER $this->user".$rn);
  echo $this->putServerMsg("PASS $this->pwd".$rn);
  print_r( $this->msg );
 }
 function openPop($popHost,$popPort=110)
 {
  if( empty($popHost) )
  {
   $this->msg[] = \\'pop host is null!\\';
   return false;
  }
  if( $fp = fsockopen($popHost,$popPort))
  {
   $this->popFp = $fp;
   //echo $this->getServerMsg();
   return true;
  }
  $this->msg[] = \\'pop server connect failure\\';
  return false;
 }
 function getServerMsg()
 {
  if( empty( $this->popFp ) )
  {
   $this->msg[] = \\'popFp is null!\\';
   print_r($this->msg);
   return false;
  }
  return fgets( $this->popFp,512);
 }
 function putServerMsg($msg)
 {
  if( empty( $this->popFp ) )
  {
   $this->msg[] = \\'popFp is null!\\';
   print_r($this->msg);
   return false;
  }
  if( feof($this->popFp))
  {
   echo "fp is end !";
   return false;
  }
  fputs( $this->popFp , $msg );
  return $this->getServerMsg();
 }
 function closeStmp()
 {
  empty($this->popFp) ? \\'\\':fclose($this->popFp);
  $this->msg[] = "close stmp";
 }
}

?>

使用

$pop = new popMail();
$pop->init();

时间仓促,没有注释,望见谅!


返回类别: 教程
上一教程: 模拟OSO的论坛(五)
下一教程: PHP操作MySQL的函数

您可以阅读与"pop mail 类 很简朴的功能(自家用)"相关的教程:
· php 顶层类(自家用)
· 在PHP3中实现SESSION的功能(附、COOKIE函数库的使用:test_cookie.php3)
· 利用static实现表格的颜色隔行显示(转载) 在实际编程应用中我们对STATIC的功能常常遗忘。要好好反省...
· 在PHP3中实现SESSION的功能(二、COOKIE函数库:cookie.inc.php3)(转译)
· apache中.htaccess文件的功能写法
    微笑服务 优质保证 索取样品