?> <div class="container"> <div class="starter-template"> <h1>STI Mail</h1> </div> <div class="container"> <?php if (isset($_POST['answer'])) { $_SESSION['answer'] = $_POST['expeditor']; header('Location: newmail.php'); } if (isset($_POST['del'])) { deleteMail($_POST['Mid']); } if (isset($_POST['read'])) { readMail($_POST['Mid'], $_POST['expeditor']); } if (!isset($_POST['read'])) { ?> <table class="table table-striped"> <thead> <tr> <th width="20%">Date</th> <th width="20%">Expeditor</th> <th width="20%">Subject</th> <th width="40%"></th> </tr> </thead>
$socket = getLoginSession($host, $port, $username, $password); $arrMailId = getMailIdList($socket); quitAndClose($socket); $totalMail = count($arrMailId); print "\nTotal mail count {$totalMail}\n\n"; // delete corrupt mail // 删除之后id会重新补齐,所以从最大id开始 // 同一封邮件id在不同会话之间不一定相同, 但可以通过UIDL来获得邮件唯一ID标识 // 所以邮件客户端会先获取UIDL, 然后再获取LIST, 最后RETR获取邮件 $totalCorrupt = 0; $cur = $totalMail - 1; while ($cur >= 0) { $n = 6; $socket = getLoginSession($host, $port, $username, $password); while ($n > 0 && $cur >= 0) { $id = $arrMailId[$cur]; $r = checkMailCorrupt($socket, $id); if ($r == 1) { $totalCorrupt++; deleteMail($socket, $id); $n--; } else { if ($r != 0) { $n--; } } $cur--; } quitAndClose($socket); } print "\nTotal mail corrupt count {$totalCorrupt}\n\n";