+ getFolderList($imapConnection, $boxesFormatted, $boxesUnformatted);
+
+ /** Lets start removing the folders and messages **/
+ if ($move_to_trash == true) { /** if they wish to move messages to the trash **/
+ /** Creates the subfolders under $trash_folder **/
+ for ($i = 0; $i < count($boxesUnformatted); $i++) {
+ if (substr($boxesUnformatted[$i], 0, strlen($mailbox)) == $mailbox) {
+ $folderWithoutINBOX = getFolderNameMinusINBOX($boxesUnformatted[$i]);
+ createFolder($imapConnection, "$trash_folder.$folderWithoutINBOX");
+ }
+ }
+ for ($i = 0; $i < count($boxesUnformatted); $i++) {
+ if (substr($boxesUnformatted[$i], 0, strlen($mailbox)) == $mailbox) {
+ selectMailbox($imapConnection, $boxesUnformatted[$i], $numMessages);
+ $folder = getFolderNameMinusINBOX($boxesUnformatted[$i]);