/** * create a new folder * * This method also creates parent folders if necessary. Some mail storages may restrict, which folder * may be used as parent or which chars may be used in the folder name * * @param string $name global name of folder, local name if $parentFolder is set * @param string|\Zend\Mail\Storage\Folder $parentFolder parent folder for new folder, else root folder is parent * @throws Exception\RuntimeException */ public function createFolder($name, $parentFolder = null) { // TODO: we assume / as the hierarchy delim - need to get that from the folder class! if ($parentFolder instanceof Folder) { $folder = $parentFolder->getGlobalName() . '/' . $name; } elseif ($parentFolder != null) { $folder = $parentFolder . '/' . $name; } else { $folder = $name; } if (!$this->protocol->create($folder)) { throw new Exception\RuntimeException('cannot create folder'); } }