国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > PHP > 正文

pop mail 類 很簡單的功能(自家用)

2024-05-04 23:04:24
字體:
來源:轉載
供稿:網友

<?php

class popmail
{
 var [email protected]';
 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='/r/n';
  //$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();

時間倉促,沒有注釋,望見諒!

,歡迎訪問網頁設計愛好者web開發。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 孟村| 峨眉山市| 桃江县| 白朗县| 淳安县| 晋州市| 扶沟县| 汉寿县| 清河县| 阳山县| 循化| 北海市| 罗定市| 平阴县| 青岛市| 衡山县| 山丹县| 兴城市| 马山县| 田东县| 棋牌| 荆门市| 双辽市| 青海省| 聊城市| 区。| 肥西县| 广汉市| 体育| 日土县| 彰化市| 长宁区| 宁乡县| 元氏县| 固始县| 临颍县| 加查县| 施秉县| 大悟县| 缙云县| 丹寨县|