$flag can be one of:
Basic flags:
- ANSWERED - message has been answered
- DELETED - message is marked to be deleted by later EXPUNGE
- DRAFT - message is marked as a draft
- FLAGGED - message is "flagged" for urgent/special attention
- RECENT - message is recent
- SEEN - message has been read
Opposites of the above flags:
- UNANSWERED
- UNDELETED
- UNDRAFT
- UNFLAGGED
- OLD
- UNSEEN
Composite flags:
- NEW - equivalent to RECENT + UNSEEN
- ALL - all the messages
Before calling this method, a connection to the IMAP server must be
established and a user must be authenticated successfully, and a mailbox
must be selected.
public countByFlag ( string $flag ) : integer | ||
$flag | string | |
Résultat | integer |
public function testUidClearFlag() { $imap = new ezcMailImapTransport(self::$server, self::$port, array('uidReferencing' => true)); $imap->authenticate(self::$user, self::$password); $imap->createMailbox("Guybrush"); $imap->selectMailbox("Inbox"); $imap->copyMessages(implode(',', self::$ids), "Guybrush"); $imap->selectMailbox("Guybrush"); $imap->clearFlag("1", "SEEN"); $imap->clearFlag("1,2", "FLAGGED"); $imap->clearFlag("3:4", "DRAFT"); $this->assertEquals(1, $imap->countByFlag("UNSEEN")); $imap->selectMailbox("Inbox"); $imap->deleteMailbox("Guybrush"); }
public function testSortWithPeek() { $imap = new ezcMailImapTransport(self::$server, self::$port); $imap->authenticate(self::$user, self::$password); $imap->createMailbox("Guybrush"); $imap->selectMailbox("Inbox"); $imap->copyMessages("1,2", "Guybrush"); $imap->selectMailbox("Guybrush"); $imap->clearFlag("1,2", "SEEN"); $this->assertEquals(0, $imap->countByFlag("SEEN")); $src = $imap->sortMessages(array(1, 2), "Subject"); $this->assertEquals(0, $imap->countByFlag("SEEN")); $imap->selectMailbox("Inbox"); $imap->deleteMailbox("Guybrush"); }