imap_mailboxmsginfo

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

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

説明

object imap_mailboxmsginfo ( int imap_stream )

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

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

表 1. mailboxのプロパティ

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

例 1. imap_mailboxmsginfo() の例

<?php

$mbox
= imap_open("{your.imap.host}INBOX","username", "password")
      or 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);

?>