-- php教程myadmin sql dump
-- version 2.11.6
-- http://www.phpmyadmin.net
--
-- host: localhost
-- generation time: jun 29, 2010 at 09:27 am
-- server version: 5.0.51
-- php version: 5.2.6
set sql_mode="no_auto_value_on_zero";
/*!40101 set @old_character_set_client=@@character_set_client */;
/*!40101 set @old_character_set_results=@@character_set_results */;
/*!40101 set @old_collation_connection=@@collation_connection */;
/*!40101 set names utf8 */;
--
-- database: `test`
--
-- --------------------------------------------------------
--
-- table structure for table `maillist`
--
create table if not exists `maillist` (
`id` int(11) not null auto_increment,
`title` text collate utf8_unicode_ci not null,
`content` mediumtext collate utf8_unicode_ci not null,
`senduser` varchar(50) collate utf8_unicode_ci not null,
`sendmail` varchar(200) collate utf8_unicode_ci not null,
`sendtime` int(11) not null,
`accept_email` varchar(200) collate utf8_unicode_ci not null,
`cc_email` varchar(200) collate utf8_unicode_ci not null,
`bcc_email` varchar(200) collate utf8_unicode_ci not null,
`msessage_id` varchar(200) collate utf8_unicode_ci not null,
`msgno` int(11) not null comment '邮件的序号,为0表示已经下载结束',
`is_download` tinyint(4) not null default '0',
primary key (`id`)
) engine=myisam default charset=utf8 collate=utf8_unicode_ci auto_increment=1 ;
--
-- dumping data for table `maillist`
--
-- --------------------------------------------------------
--
-- table structure for table `mail_account`
--
create table if not exists `mail_account` (
`id` int(11) not null auto_increment,
`username` varchar(100) not null,
`password` varchar(50) not null,
`emailaddress` varchar(100) not null,
`mailserver` varchar(50) not null,
`servertype` varchar(10) not null,
`port` varchar(10) not null,
primary key (`id`)
) engine=myisam default charset=latin1 auto_increment=1 ;
--
-- dumping data for table `mail_account`
--
-- --------------------------------------------------------
--
-- table structure for table `mail_attach`
--
create table if not exists `mail_attach` (
`id` int(11) not null auto_increment,
`mail_id` int(11) not null,
`filename` varchar(200) collate utf8_unicode_ci not null,
`filename_tmp` varchar(200) collate utf8_unicode_ci not null,
`download_time` datetime not null,
primary key (`id`)
) engine=myisam default charset=utf8 collate=utf8_unicode_ci auto_increment=1 ;
--
-- dumping data for table `mail_attach`
--
config.php文件
$path = "d:/phpnow/htdocs/attach/";
$urlpath = "http://localhost/attach/";
?>
list.php邮箱列表页面
header("content-type: text/html; charset=utf-8");
header('expires: '.date('d,d m y h:i:s',mktime(0,0,0,1,1,2000)).' gmt');
header('last-modified:'.gmdate('d,d m y h:i:s').' gmt');
header('cache-control: private, no-cache,must-revalidate');
header('pragma: no-cache');
include_once 'dbconfig.php';
$dblink = mysql教程_connect("localhost",$dbuser,$dbpasswd);
mysql_query("set names 'utf8'");
mysql_select_db("test");
$emailaddress = $_request['email'];
?>
收邮件 | 发邮件 |
$title | ";$senduser | ";$senddate | ";查看 | ";查看 | ";$msgflag | ";
receuv.php收邮件页面
set_time_limit(0);
include_once 'imap.php';
include_once 'dbconfig.php';
$dblink = mysql_connect("localhost",$dbuser,$dbpasswd);
mysql_query("set names 'utf8'");
mysql_select_db("test");
$emailaddress = $_request['email'];
$sql = "select * from mail_account where emailaddress='".$emailaddress."'";
$rlt = mysql_query($sql);
$row = mysql_fetch_array($rlt);
$username = $row['username'];
$password = $row['password'];
$emailaddress = $row['emailaddress'];
$mailserver = $row['mailserver'];
$servertype = $row['servertype'];
$port = $row['port'];
$mail = new imap($username,$password,$emailaddress,$mailserver,$servertype,$port,false);
$mail->open();
$mailnum = $mail->getmaillist();
for($i=1;$i<=$mailnum;$i++){
$mailheader = $mail->head($i);
//echo "
";print_r($mailheader);echo "";
read_mail.php读取邮件页面
include_once 'dbconfig.php';
$msessage_id = $_request['msessage_id'];
$udate = $_request['udate'];
$msgno = $_request['msgno'];
$dblink = mysql_connect("localhost",$dbuser,$dbpasswd);
mysql_query("set names 'utf8'");
mysql_select_db("test");
$email = $_request['email'];
?>
getmailbody.php页面代码
set_time_limit(0);
header("content-type: text/html; charset=utf-8");
include_once 'imap.php';
include_once 'dbconfig.php';
$dblink = mysql_connect("localhost",$dbuser,$dbpasswd);
mysql_query("set names 'utf8'");
mysql_select_db("test");
$msessage_id = $_request['msessage_id'];
$udate = $_request['udate'];
$msgno = $_request['msgno'];
$emailaddress = $_request['email'];
$sql = "select id,is_download from maillist where sendtime='".$udate."' and msessage_id='".$msessage_id."'";
$rlt = mysql_query($sql);
$row = mysql_fetch_array($rlt);
$is_download = $row['is_download'];
$mail_id = $row['id'];
if($is_download==0){
$d = 1;
$sql = "select * from mail_account where emailaddress='".$emailaddress."'";
$rlt = mysql_query($sql);
$row = mysql_fetch_array($rlt);
$username = $row['username'];
$password = $row['password'];
$emailaddress = $row['emailaddress'];
$mailserver = $row['mailserver'];
$servertype = $row['servertype'];
$port = $row['port'];
/**
*+----------------------------------------------------------------------------------------------------+
*| imap message class - recevie mailbox by imap |
*| |
*| author: tiger zhang |
*| mailto: [email protected] |
*| |
*| |
*| (c) copyright 2010, tiger zhang, all rights reseverd |
*+----------------------------------------------------------------------------------------------------+
**
*/
class imap{
var $server='';
var $username='';
var $password='';
var $marubox='';
var $email='';
var $linkserver;//email stream
var $error;
var $mailnum = 0;
var $partsary = array();
var $data_types; // (array)(string) various message part types
var $encoding_types; // (array)(string) various encoding types
var $structure; // (array)(object) contains the complete body structure
var $pid; // (array)(array)(str) part id
var $file_type; // (array)(array)(str) mime type
var $disposition; // (array)(array)(str) inline | attachment
var $fsize; // (array)(array)(int) part size in bytes
var $encoding; // (array)(array)(str) message encoding
var $fname; // (array)(array)(str) original file name
var $inline_id; // (array)(array)(str) string containing the id for multipart/related
var $has_attachments; // (array)(array)(bool)
var $file_code; // (array)(array)(str) charset
function imap($username,$password,$emailaddress,$mailserver='localhost',$servertype='pop',$port='110',$ssl = false){
if($servertype=='imap')
{
if($port=='') $port='143';
$strconnect='{'.$mailserver.':'.$port. '}inbox';
}
else
{
$strconnect='{'.$mailserver.':'.$port. '/pop3'.($ssl ? "/ssl" : "").'}inbox';
}
$this->server = $strconnect;
$this->username = $username;
$this->password = $password;
$this->email = $emailaddress;
}
function open(){
//$this->linkserver = @imap_open($this->mailbox,$this->username,$this->password);
$this->linkserver=@imap_open($this->server,$this->username,$this->password) or die("connecting to mail server,refresh");
if(!$this->linkserver)
{
echo "error: connecting to mail server,refresh";
exit;
}
}
function checkopen(){
if(imap_ping($this->linkserver) === false){
$this->error = 'imap_open的连接错误:'.imap_last_error();
return false;
}else{
$this->error = 'ok';
return true;
}
}
function nd(){
$checkresult = imap_check($this->linkserver);
$nummsgs = $checkresult->nmsgs;
$date = $checkresult->date;
$checkreturn[] = $nummsgs;
$checkreturn[] = $date;
return $checkreturn;
}
function getmsgno($messageid){
return imap_uid($this->linkserver,$messageid);
}
/**
* 获取邮件总数
*
*/
function getmaillist(){
$checkresult = imap_check($this->linkserver);
$nummsgs = $checkresult->nmsgs;
return $nummsgs;
}
/**
* 获取邮件头内容
* @param unknown_type $id
* @param unknown_type $all
* @param unknown_type $several
* @return array
(
[id] => 4
[size] => 1697
[message_id] =>
[udate] => 1276687275
[subject] => 测试
[charset] => gbk
[topersonal] => test
[tocharset] => gbk
[to] => [email protected]
[frompersonal] => 五月的饼干屋
[fromcharset] => gbk
[from] => [email protected]
)
*/
function head($id = '',$allhead=false,$all = false,$several = array()){
if($all == true){
$checkreturn = imap::nd();
$nummsgs = $checkreturn[0];
for($i=0;$i<$nummsgs;$i++){
$head_array[$i]['id'] = $i+1;
$head = imap_header($this->linkserver,$i+1);
if($head->udate == ''){
$head_array[$i]['udate'] = '';
}else{
$head_array[$i]['udate'] = $head->udate;
}
if($head->subject == ''){
$head_array[$i]['subject'] = '';
}else{
$head_array[$i]['subject'] = $head->subject;
$analyze_charset = imap_mime_header_decode($head_array[$i]['subject']);
//echo "
".print_r($analyze_charset);echo "";
function analyze_body($id){
$structure = imap_fetchstructure($this->linkserver,$id);
return $structure;
}
/**
* 设置code和filetype
*
*/
function settype()
{
$this->data_types = array();
$this->data_types[0] = 'text';
$this->data_types[1] = 'multipart';
$this->data_types[2] = 'message';
$this->data_types[3] = 'application';
$this->data_types[4] = 'audio';
$this->data_types[5] = 'image';
$this->data_types[6] = 'video';
$this->data_types[7] = 'other';
$this->encoding_types = array();
$this->encoding_types[0] = '7bit';
$this->encoding_types[1] = '8bit';
$this->encoding_types[2] = 'binary';
$this->encoding_types[3] = 'base64';
$this->encoding_types[4] = 'quoted-printable';
$this->encoding_types[5] = 'other';
return;
}
/**
* * 遍历structure取出所有的相关信息
*
* @param unknown_type $mid
* @param unknown_type $sub_part
* @param unknown_type $sub_pid
* @param unknown_type $n
* @param unknown_type $is_sub_part
* @param unknown_type $skip_part
* @return unknown
*+----------------------------------------------------------------------------------------------------+
*| imap message scanner - scans information provided by imap_fetchstructure() |
*| |
*| author: richard york |
*| mailto:richy at smilingsouls.net |
*| http://www.smilingsouls.net |
*| modified by:tiger zhang(2010-6-20) |
*| |
*| (c) copyright 2004, richard york, all rights reseverd |
*+----------------------------------------------------------------------------------------------------+
**
*/
if (isset($this->structure[$mid]->parts) || is_array($sub_part))
{
if ($is_sub_part == false)
{
$parts = $this->structure[$mid]->parts;
}
else
{
$parts = $sub_part;
$n++;
}
for($p = 0, $i = 1; $p < count($parts); $n++, $p++, $i++)
{
// skip the following...
// skip multipart/mixed!
// skip subsequent multipart/alternative if this part is message/rfc822
// skip multipart/related
$ftype = (empty($parts[$p]->type))? $this->data_types[0].'/'.strtolower($parts[$p]->subtype) : $this->data_types[$parts[$p]->type].'/'.strtolower($parts[$p]->subtype);
$encoding = (empty($parts[$p]->encoding))? $this->encoding_types[0] : $this->encoding_types[$parts[$p]->encoding];
$skip_next = ($ftype == 'message/rfc822')? true : false;
if ($ftype == 'multipart/mixed' || $skip_part == true && $ftype == 'multipart/alternative' || $ftype == 'multipart/related')
{
$n--;
}
else
{
$this->pid[$mid][$n] = ($is_sub_part == false)? $i : $sub_pid.'.'.$i;
$this->file_type[$mid][$n] = $ftype;
$this->encoding[$mid][$n] = $encoding;
$this->fsize[$mid][$n] = (!isset($parts[$p]->bytes) || empty($parts[$p]->bytes))? 0 : $parts[$p]->bytes;
# force inline disposition if none is present
if ($parts[$p]->ifdisposition == true)
{
$this->disposition[$mid][$n] = strtolower($parts[$p]->disposition);
if (strtolower($parts[$p]->disposition) == 'attachment')
{
if ($parts[$p]->ifdparameters == true)
{
$params = $parts[$p]->dparameters;
foreach ($params as $param)
{
if(strtolower($param->attribute) == 'filename')
{
$this->fname[$mid][$n] = $param->value;
break;
}
}
}
}else if (strtolower($parts[$p]->disposition) == 'inline')
{
if ($parts[$p]->ifdparameters == true)
{
$params = $parts[$p]->dparameters;
foreach ($params as $param)
{
if(strtolower($param->attribute) == 'filename')
{
$this->fname[$mid][$n] = $param->value;
break;
}
}
}
}
}
else if ($parts[$p]->ifparameters == true)
{
$this->disposition[$mid][$n] = 'inline';
$params = $parts[$p]->parameters;
foreach ($params as $param)
{
if(strtolower($param->attribute) == 'name')
{
$this->fname[$mid][$n] = $param->value;
break;
}else if(strtolower($param->attribute) == 'charset'){
$this->file_code[$mid][$n] = strtolower($param->value);
&n
我的博物馆故事 官方安卓版v1.61.2
我的博物馆故事是一款以消除为主题的经营养成类手游,在这里玩家
专业模拟飞行10 手机版v12.2.4
专业模拟飞行10安卓版是一款飞行休闲手游,顶尖的物理飞行引擎
动物起义战斗模拟器二琳同款 最新版v4.1.1
动物起义战斗模拟器是一个非常有趣的模拟类游戏,玩家可以召唤各
迷你世界七周年 安卓手机版v1.43.0
迷你世界7周年是一款由《迷你世界》官方推出的庆祝特别版本,在
劫后公司无限资源版 v1.0.5.1
劫后公司内置菜单版是游戏的破解版本,在该版本中为玩家提供了内