protected function _mailboxExists($mbox) { $mailboxes = $this->_imap->getMailboxes(true); foreach ($mailboxes as $mailbox) { if ($mailbox['ob']->utf8 == $mbox) { return true; } } return false; }