private function ensure_mailboxes_exist() {

        $requiredmailboxes = array(
            self::MAILBOX,
            $this->get_confirmation_folder(),
        );

        $existingmailboxes = $this->client->listMailboxes($requiredmailboxes);
        foreach ($requiredmailboxes as $mailbox) {
            if (isset($existingmailboxes[$mailbox])) {
                // This mailbox was found.
                continue;
            }

            mtrace("Unable to find the '{$mailbox}' mailbox - creating it.");
            $this->client->createMailbox($mailbox);
        }
    }