ezcMailImapTransport::disconnect PHP 메소드

disconnect() 공개 메소드

Disconnects the transport from the IMAP server.
public disconnect ( )
    public function disconnect()
    {
        if ($this->state !== self::STATE_NOT_CONNECTED && $this->connection->isConnected() === true) {
            $tag = $this->getNextTag();
            $this->connection->sendData("{$tag} LOGOUT");
            // discard the "bye bye" message ("{$tag} OK Logout completed.")
            $this->getResponse($tag);
            $this->state = self::STATE_LOGOUT;
            $this->selectedMailbox = null;
            $this->connection->close();
            $this->connection = null;
            $this->state = self::STATE_NOT_CONNECTED;
        }
    }

Usage Example

예제 #1
0
 public function testCapabilityNotConnected()
 {
     $imap = new ezcMailImapTransport(self::$server, self::$port);
     $imap->disconnect();
     try {
         $imap->capability();
         $this->fail("Expected exception was not thrown.");
     } catch (ezcMailTransportException $e) {
     }
 }