<?php session_start();
include_once("conn/conn.php");
$hostname=$_SESSION[host];
$username=$_SESSION[user];
$userpwd=$_SESSION[pwd];
if(!$mbox=@imap_open("$hostname","$username","$userpwd")){
   echo "<script>alert('登录超时，请重新登录!');history.back();</script>";
   exit;
} 
$i=0;
while(list($name,$value)=each($_POST)){
  if(is_numeric($name)==true){
        $i+=$name;
		imap_delete($mbox,$name);



		$sql="delete from tb_mail_read where tb_mail_time='$value'";
		$conn -> Execute($sql);



  }		
}
if($i==0){
 echo "<script>alert('请选择要删除的邮件!');history.back();</script>";
 imap_close($mbox);
 exit;
}else{
  imap_expunge($mbox);
 


  imap_close($mbox);
 echo "<script>window.location.href='index.php?lmbs=收件箱'</script>";
}
?>