程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> PHP編程 >> 關於PHP編程 >> POP3、SMTP郵件收發程序

POP3、SMTP郵件收發程序

編輯:關於PHP編程

<?php
if ($EMAIL_INC) return;
$EMAIL_INC= "defined";
define( "SmtpPort",25);
class Pop3 {
var $subject; // 郵件主題
var $from_email; // 發件人地址
var $from_name; // 發件人姓名
var $to_email; // 收件人地址
var $to_name; // 收件人姓名
var $body; // 郵件內容
var $filename; // 文件名
var $socket; // 當前的 socket
var $Line;
var $Status;
function pop3_open($server, $port)
{
$this->Socket = fsockopen($server, $port);
if ($this->Socket <= 0){
return false;
}
$this->Line = fgets($this->Socket, 1024);
$this->Status[ "LASTRESULT"] = substr($this->Line, 0, 1);
$this->Status[ "LASTRESULTTXT"] = substr($this->Line, 0, 1024);
if ($this->Status[ "LASTRESULT"] <> "+") return false;
return true;
}
function pop3_user($user)
{
if ($this->Socket < 0){
return false;
}
fputs($this->Socket, "USER $this->userrn");
$this->Line = fgets($this->Socket, 1024);
$this->Status[ "LASTRESULT"] = substr($this->Line, 0, 1);
$this->Status[ "LASTRESULTTXT"] = substr($this->Line, 0, 1024);
if ($this->Status[ "LASTRESULT"] <> "+") return false;
return true;
}
function pop3_pass( $pass)
{
fputs($this->Socket, "PASS $passrn");
$this->Line = fgets($this->Socket, 1024);
$this->Status[ "LASTRESULT"] = substr($this->Line, 0, 1);
$this->Status[ "LASTRESULTTXT"] = substr($this->Line, 0, 1024);
if ($this->Status[ "LASTRESULT"] <> "+") return 0;
return 1;
}
function pop3_stat()
{
fputs($this->Socket, "STATrn");
$this->Line = fgets($this->Socket, 1024);
$this->Status[ "LASTRESULT"] = substr($this->Line, 0, 1);
$this->Status[ "LASTRESULTTXT"] = substr($this->Line, 0, 1024);
if ($this->Status[ "LASTRESULT"] <> "+") return 0;

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved