/** * This function creates or reopens an imap_stream when called. */ protected function setImapStream() { if (isset($this->imap_stream)) { $this->imap->reopen($this->imap_stream, $this->getServerString(), $this->options, 1); } else { $this->imap_stream = $this->imap->open($this->getServerString(), $this->username, $this->password, $this->options, 1); } }