(PHP 4, PHP 5, PHP 7, PHP 8)
imap_mailboxmsginfo — 取得目前信箱的資訊
檢查伺服器上目前信箱的狀態。它類似於 imap_status(),但會額外加總信箱中所有郵件的大小,這需要一些額外的執行時間。
以物件形式返回資訊,具有以下屬性
Date | 上次變更日期 (目前日期時間) |
Driver | 驅動程式 |
Mailbox | 信箱名稱 |
Nmsgs | 郵件數量 |
Recent | 最近郵件數量 |
Unread | 未讀郵件數量 |
Deleted | 已刪除郵件數量 |
大小 | 信箱大小 |
版本 | 說明 |
---|---|
8.1.0 | imap 參數現在需要一個 IMAP\Connection 實例;先前需要一個有效的 imap 資源。 |
範例 #1 imap_mailboxmsginfo() 範例
<?php
$mbox = imap_open("{imap.example.org}INBOX", "username", "password")
or die("無法連線: " . imap_last_error());
$check = imap_mailboxmsginfo($mbox);
if ($check) {
echo "日期: " . $check->Date . "<br />\n" ;
echo "驅動程式: " . $check->Driver . "<br />\n" ;
echo "信箱: " . $check->Mailbox . "<br />\n" ;
echo "訊息數量: " . $check->Nmsgs . "<br />\n" ;
echo "最近: " . $check->Recent . "<br />\n" ;
echo "未讀: " . $check->Unread . "<br />\n" ;
echo "已刪除: " . $check->Deleted . "<br />\n" ;
echo "大小: " . $check->Size . "<br />\n" ;
} else {
echo "imap_mailboxmsginfo() 失敗: " . imap_last_error() . "<br />\n";
}
imap_close($mbox);
?>