Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
PHP: imap_status - Manual
[go: Go Back, main page]

PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

imap_subscribe" width="11" height="7"/> <imap_sort
Last updated: Thu, 31 May 2007

view this page in

imap_status

(PHP 4, PHP 5)

imap_status — 現在のメールボックス以外のメールボックスのステータス情報を返す

説明

object imap_status ( resource $imap_stream, string $mailbox, int $options )

指定したメールボックス mailbox についてのステータス情報を取得します。

パラメータ

imap_stream

imap_open() が返す IMAP ストリーム。

mailbox

メールボックス名。詳細は imap_open() を参照ください。

options

以下のフラグが使用できます。

  • SA_MESSAGES - status->messages にメールボックスのメッセージ数を設定する
  • SA_RECENT - status->recent にメールボックスの最近のメッセージ数を設定する
  • SA_UNSEEN - status->unseen にメールボックスの未読の(新規)メッセージ数を設定する
  • SA_UIDNEXT - status->uidnext にメールボックスの次の UID を設定する
  • SA_UIDVALIDITY - メールボックスの UID がもはや有効ではない場合に変化する定数を status->uidvalidity に設定する
  • SA_ALL - 上記のものをすべて設定する

返り値

この関数は、ステータス情報を含むオブジェクトを返します。このオブジェクトには messagesrecentunseenuidnext および uidvalidity というプロパティが含まれます。

flags にも、 上の各定数に対応するビットマスクを設定することができます。

例 1019. imap_status() の例

<?php
$mbox
= imap_open("{imap.example.com}", "username", "password", OP_HALFOPEN)
      or die(
"接続できません: " . imap_last_error());

$status = imap_status($mbox, "{imap.example.org}INBOX", SA_ALL);
if (
$status) {
  echo
"Messages:   " . $status->messages    . "<br />\n";
  echo
"Recent:     " . $status->recent      . "<br />\n";
  echo
"Unseen:     " . $status->unseen      . "<br />\n";
  echo
"UIDnext:    " . $status->uidnext     . "<br />\n";
  echo
"UIDvalidity:" . $status->uidvalidity . "<br />\n";
} else {
  echo
"imap_status failed: " . imap_last_error() . "\n";
}

imap_close($mbox);
?>



add a note add a note User Contributed Notes
imap_status
jille at DIESPAMMERShexon dot cx
03-May-2007 10:21
In 'reply' to my previous post;
I`m not sure of that anymore
I think this trick works,
but the rest of my script just sucks..

Conclusion:
You can get the last UID by using status->uidnext-1
BUT: This is not a good way, if another message is added after your append and before your status; you are screwed

imap_subscribe" width="11" height="7"/> <imap_sort
Last updated: Thu, 31 May 2007
 
 
show source | credits | sitemap | contact | advertising | mirror sites