ezcMailImapTransport::fetchByFlag PHP Method

fetchByFlag() public method

This method supports unique IDs instead of message numbers. See {@link ezcMailImapTransportOptions} for how to enable unique IDs referencing. $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. Example: $imap = new ezcMailImapTransport( 'imap.example.com' ); $imap->authenticate( 'username', 'password' ); $imap->selectMailbox( 'mailbox' ); // Inbox or another mailbox Fetch the messages marked with the RECENT flag $set = $imap->fetchByFlag( 'RECENT' ); $set can be parsed with ezcMailParser
public fetchByFlag ( string $flag ) : ezcMailImapSet
$flag string
return ezcMailImapSet
    public function fetchByFlag($flag)
    {
        $messages = $this->searchByFlag($flag);
        return new ezcMailImapSet($this->connection, $messages, false, array('uidReferencing' => $this->options->uidReferencing));
    }

Usage Example

コード例 #1
0
 public function testUidFetchByFlagNotSelected()
 {
     $imap = new ezcMailImapTransport(self::$server, self::$port, array('uidReferencing' => true));
     $imap->authenticate(self::$user, self::$password);
     try {
         $set = $imap->fetchByFlag("undeleted");
         $this->fail("Expected exception was not thrown.");
     } catch (ezcMailTransportException $e) {
     }
 }
All Usage Examples Of ezcMailImapTransport::fetchByFlag