public function create_folder($folder, $subscribe = false, $type = null)
    {
        if (!$this->check_connection()) {
            return false;
        }

        $result = $this->conn->createFolder($folder, $type ? array("\\" . ucfirst($type)) : null);

        // try to subscribe it
        if ($result) {
            // clear cache
            $this->clear_cache('mailboxes', true);

            if ($subscribe) {
                $this->subscribe($folder);
            }
        }

        return $result;
    }