Skip to content

Commit 82ac9f1

Browse files
LimmanWebklex
authored andcommitted
createFolder() fixed, renameFolder() and deleteFolder() methods added. (#91)
1 parent 35c2da5 commit 82ac9f1

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

src/IMAP/Client.php

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,32 @@ public function openFolder(Folder $folder, $attempts = 3) {
322322
*/
323323
public function createFolder($name) {
324324
$this->checkConnection();
325-
326-
return imap_createmailbox($this->connection, imap_utf7_encode($name));
325+
return imap_createmailbox($this->connection, $this->getAddress() . imap_utf7_encode($name));
326+
}
327+
328+
/**
329+
* Rename Folder
330+
* @param string $old_name
331+
* @param string $new_name
332+
*
333+
* @return bool
334+
* @throws ConnectionFailedException
335+
*/
336+
public function renameFolder($old_name, $new_name) {
337+
$this->checkConnection();
338+
return imap_renamemailbox($this->connection, $this->getAddress() . imap_utf7_encode($old_name), $this->getAddress() . imap_utf7_encode($new_name));
339+
}
340+
341+
/**
342+
* Delete Folder
343+
* @param string $name
344+
*
345+
* @return bool
346+
* @throws ConnectionFailedException
347+
*/
348+
public function deleteFolder($name) {
349+
$this->checkConnection();
350+
return imap_deletemailbox($this->connection, $this->getAddress() . imap_utf7_encode($name));
327351
}
328352

329353
/**

0 commit comments

Comments
 (0)