IMAP, POP3 및 NNTP imap_status
(PHP 4, PHP 5, PHP 7, PHP 8)
imap_status — 사서함에 대한 상태 정보를 반환합니다.
설명
imap_status(IMAP\Connection $imap
, string $mailbox
, int $flags
): stdClass|false
지정된 mailbox
에 대한 상태 정보를 가져옵니다.
매개변수
imap
- IMAP\Connection 인스턴스입니다.
mailbox
- 사서함 이름, 자세한 내용은 imap_open()을 참조하십시오.
경고 imap.enable_insecure_rsh가 비활성화되지 않는 한 신뢰할 수 없는 데이터를 이 매개변수에 전달하는 것은 안전하지 않습니다.
flags
- 유효한 플래그는 다음과 같습니다.
-
SA_MESSAGES
- set $status->messages to the number of messages in the mailbox -
SA_RECENT
- set $status->recent to the number of recent messages in the mailbox -
SA_UNSEEN
- set $status->unseen to the number of unseen (new) messages in the mailbox -
SA_UIDNEXT
- set $status->uidnext to the next uid to be used in the mailbox -
SA_UIDVALIDITY
- set $status->uidvalidity to a constant that changes when uids for the mailbox may no longer be valid -
SA_ALL
- set all of the above
-
반환 값
이 함수는 상태 정보가 포함된 개체를 반환하거나 실패 시 false
를 반환합니다. 개체에는 messages
, recent
, unseen
, uidnext
및 uidvalidity
속성이 있습니다.
위의 상수에 대해 확인할 수 있는 비트 마스크가 포함된 flags
도 설정됩니다.
변경 로그
버전 | 설명 |
---|---|
8.1.0 | imap 매개변수는 이제 IMAP\Connection 인스턴스를 필요로 합니다. 이전에는 리소스가 필요했습니다. |
Examples
예제 #1 imap_status() 예제
<?php
$mbox = imap_open("{imap.example.com}", "username", "password", OP_HALFOPEN)
or die("can't connect: " . 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);
?>