ezcMailImapTransport::expunge PHP Method

expunge() public method

This method permanently deletes the messages marked for deletion by the method {@link delete()}. 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 expunge ( )
    public function expunge()
    {
        if ($this->state != self::STATE_SELECTED) {
            throw new ezcMailTransportException("Can not issue EXPUNGE command if a mailbox is not selected.");
        }
        $tag = $this->getNextTag();
        $this->connection->sendData("{$tag} EXPUNGE");
        $response = trim($this->getResponse($tag));
        if ($this->responseType($response) != self::RESPONSE_OK) {
            throw new ezcMailTransportException("EXPUNGE failed: {$response}.");
        }
    }

Usage Example

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