<?php session_start();
header('Content-Type: text/xml');
$hostname=$_SESSION[host];
$username=$_SESSION[user];
$userpwd=$_SESSION[pwd];
$mbox=imap_open("$hostname","$username","$userpwd");
$check = imap_mailboxmsginfo($mbox);
$sum=$check->Unread;
for($i=1;$i<=$sum;$i++){
	$obj=imap_header($mbox,$i);
  	$array=strtotime($obj->date);
	include_once ("conn/conn.php");						//载入adodb.ini.php文件
	$sql="select * from tb_mail_read where tb_mail_time='$array'";
	$rst = $conn -> Execute($sql);	//执行pageExecute函数
	while(!$rst -> EOF){											//配合wihle语句循环输出结果
		$status = imap_setflag_full($mbox, $i, "\\Seen");
		$rst -> movenext();
	}
}





                          
  $check = imap_mailboxmsginfo($mbox);
		  $sum=$check->Unread;
$j=0;
		 
		  
		  for($i=1;$i<=$sum;$i++){


		    $obj=imap_header($mbox,$i);

			if($obj->Recent=="N"){
$j++;


									  }
}
echo $j;
?>