imap_mailboxmsginfo

(PHP 3>= 3.0.2, PHP 4 >= 4.0.0)

imap_mailboxmsginfo -- 現在のメールボックスに関する情報を得る

説明

array imap_mailboxmsginfo (int imap_stream)

現在のメールボックスに関する情報を返します。 失敗した場合にFALSEを返します。

imap_mailboxmsginfo() 関数は、 サーバーにおける現在のメールボックスのステータスを調べ、 次のプロパティを有するオブジェクトの情報を返します。 この関数はimap_status()に似ていますが、 メールボックスの中の全てのメッセージのサイズを合計します。 このため、実行時間は幾分余計にかかります。

表 1mailboxのプロパティ

Date 最終変更日
Driver ドライバ
Mailboxメールボックスの名前
Nmsgs メッセージ数
Recent 最近のメッセージの数
Unread 未読のメッセージの数
Size メールボックスのサイズ

例 1imap_mailboxmsginfo() の例


<?php

$mbox = imap_open("{your.imap.host}INBOX","username", "password")
      || die("can't connect: ".imap_last_error());
 
$check = imap_mailboxmsginfo($mbox);
 
if($check) {
    print "Date: "    . $check->Date    ."<br>\n" ;
    print "Driver: "  . $check->Driver  ."<br>\n" ;
    print "Mailbox: " . $check->Mailbox ."<br>\n" ;
    print "Messages: ". $check->Nmsgs   ."<br>\n" ;
    print "Recent: "  . $check->Recent  ."<br>\n" ;
    print "Unread: "  . $check->Unread  ."<br>\n" ;
    print "Deleted: " . $check->Deleted ."<br>\n" ;
    print "Size: "    . $check->Size    ."<br>\n" ;
} else {
    print "imap_check() failed: ".imap_last_error(). "<br>\n";
}
 
imap_close($mbox);

?>