From 9518a567b0d312f5a3258704c8e69c7240b70425 Mon Sep 17 00:00:00 2001 From: Alex <9432322+Limman@users.noreply.github.com> Date: Fri, 20 Apr 2018 18:02:43 +0300 Subject: [PATCH] createFolder() fixed, renameFolder() and deleteFolder() methods added. --- src/IMAP/Client.php | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/IMAP/Client.php b/src/IMAP/Client.php index 0ecb14d..1ff976e 100644 --- a/src/IMAP/Client.php +++ b/src/IMAP/Client.php @@ -322,8 +322,32 @@ public function openFolder(Folder $folder, $attempts = 3) { */ public function createFolder($name) { $this->checkConnection(); - - return imap_createmailbox($this->connection, imap_utf7_encode($name)); + return imap_createmailbox($this->connection, $this->getAddress() . imap_utf7_encode($name)); + } + + /** + * Rename Folder + * @param string $old_name + * @param string $new_name + * + * @return bool + * @throws ConnectionFailedException + */ + public function renameFolder($old_name, $new_name) { + $this->checkConnection(); + return imap_renamemailbox($this->connection, $this->getAddress() . imap_utf7_encode($old_name), $this->getAddress() . imap_utf7_encode($new_name)); + } + + /** + * Delete Folder + * @param string $name + * + * @return bool + * @throws ConnectionFailedException + */ + public function deleteFolder($name) { + $this->checkConnection(); + return imap_deletemailbox($this->connection, $this->getAddress() . imap_utf7_encode($name)); } /**