Example #1
0
 /**
  * Disconnects the transport from the IMAP server.
  */
 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;
     }
 }