diff --git a/expressoMail1_2/inc/class.imap_functions.inc.php b/expressoMail1_2/inc/class.imap_functions.inc.php
index 4f1c2a7..0c5f133 100755
--- a/expressoMail1_2/inc/class.imap_functions.inc.php
+++ b/expressoMail1_2/inc/class.imap_functions.inc.php
@@ -2166,33 +2166,66 @@ class imap_functions
 	}
 
 
-	function create_mailbox($arr)
+	function create_mailbox( $params )
 	{
-		$namebox	= $arr['newp'];
+		$nameBox	= $params['newp'];
 		$mbox_stream = $this->open_mbox();
 		$imap_server = $_SESSION['phpgw_info']['expressomail']['email_server']['imapServer'];
-		$namebox = mb_convert_encoding($namebox, "UTF7-IMAP", "UTF-8");
+		$nameBox = mb_convert_encoding($nameBox, "UTF7-IMAP", "UTF-8");
 
-		if( preg_match("/^user\/.*?\//i", $namebox, $matches)) {
+		// System folders
+		$draftFolder = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder'];
+		$trashFolder = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder'];
+		$sentFolder = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder'];
+		$spamFolder = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder'];
+
+		if( preg_match("/^user\/.*?\//i", $nameBox, $matches)) {
 			$userSharedFolder = $matches[0];
 			$userSharedFolder = trim($userSharedFolder);
 			$userSharedFolder = substr($userSharedFolder, 0, strlen($userSharedFolder) - 1);
 			$foldersDefault = array(
 				$userSharedFolder,
-				$userSharedFolder . $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder'],
-				$userSharedFolder . $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder'],
-				$userSharedFolder . $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder'],
-				$userSharedFolder . $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder']
+				$userSharedFolder . $this->imap_delimiter . $draftFolder,
+				$userSharedFolder . $this->imap_delimiter . $trashFolder,
+				$userSharedFolder . $this->imap_delimiter . $sentFolder,
+				$userSharedFolder . $this->imap_delimiter . $spamFolder
 			);
 			
-			if (array_search($namebox, $foldersDefault)) {
+			if (array_search($nameBox, $foldersDefault)) {
+				return array("status" => false, "error" => "You don't have permission for this operation!");
+			}
+
+		} else {
+
+			//Draft Folder
+			if( preg_match( "/^INBOX?(\/|\.)".$draftFolder."$/i", $nameBox ) ){
+				$nameBox = "INBOX" . $this->imap_delimiter . $draftFolder;
+			}
+			
+			//Trash Folder
+			if( preg_match( "/^INBOX?(\/|\.)".$trashFolder."$/i", $nameBox ) ){
+				$nameBox = "INBOX" . $this->imap_delimiter . $trashFolder;
+			}
+
+			//Sent Folder
+			if( preg_match( "/^INBOX?(\/|\.)".$sentFolder."$/i", $nameBox ) ){
+				$nameBox = "INBOX" . $this->imap_delimiter . $sentFolder;
+			}
+
+			//Spam Folder
+			if( preg_match( "/^INBOX?(\/|\.)".$spamFolder."$/i", $nameBox ) ){
+				$nameBox = "INBOX" . $this->imap_delimiter . $spamFolder;
+			}
+
+			// INBOX || INBOX/INBOX 
+			if( preg_match( "/^(INBOX|INBOX\/INBOX|INBOX\.INBOX|Caixa de Entrada)$/i", $nameBox ) ){
 				return array("status" => false, "error" => "You don't have permission for this operation!");
 			}
 		}
 
 		$result['status'] = true;
 
-		if(!imap_createmailbox($mbox_stream,"{".$imap_server."}$namebox")){
+		if(!imap_createmailbox($mbox_stream,"{".$imap_server."}$nameBox")){
 			$result = array(
 				"status" => false,
 				"error" => implode("<br />\n", imap_errors())
@@ -2235,14 +2268,17 @@ class imap_functions
 		return true;
 	}
 
-	function delete_mailbox($arr)
+	function delete_mailbox($params)
 	{
-		$namebox = $arr['del_past'];
+		$nameBox = trim($params['del_past']);
 		$imap_server = $_SESSION['phpgw_info']['expressomail']['email_server']['imapServer'];
 		$mbox_stream = $this->mbox ? $this->mbox : $this->open_mbox();
-		$namebox = mb_convert_encoding($namebox, "UTF7-IMAP", "UTF-8");
+		$nameBox = mb_convert_encoding($nameBox, "UTF7-IMAP", "UTF-8");
+		
+		$foldersDefault = array();
+		$errorMsg = "";
 
-		if( preg_match("/^user\/.*?\//i", $namebox, $matches)) {
+		if( preg_match("/^user\/.*?\//i", $nameBox, $matches)) {
 			$userSharedFolder = $matches[0];
 			$userSharedFolder = trim($userSharedFolder);
 			$userSharedFolder = substr($userSharedFolder, 0, strlen($userSharedFolder) - 1);
@@ -2253,24 +2289,36 @@ class imap_functions
 				$userSharedFolder . $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder'],
 				$userSharedFolder . $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder']
 			);
-			
-			if (array_search($namebox, $foldersDefault)) {
-				return array("status" => false, "error" => "You don't have permission for this operation!");
-			}
-		}
-		
-		$result['status'] = true;
 
-		if (!imap_deletemailbox($mbox_stream,"{".$imap_server."}$namebox")) {
-			$result = array(
-				"status" => false,
-				"error" => imap_last_error()
+			$errorMsg = "You don't have permission for this operation!";
+
+		} else {
+			
+			$foldersDefault = array(
+				'INBOX',
+				'INBOX' . $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder'],
+				'INBOX' . $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder'],
+				'INBOX' . $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder'],
+				'INBOX' . $this->imap_delimiter . $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder']
 			);
+			
+			$errorMsg = "It's not possible delete the selected folder";
 		}
 
-		if($mbox_stream){ $this->close_mbox($mbox_stream); }
+		if( array_search($nameBox, $foldersDefault) ) {
+			return array("status" => false, "error" => $errorMsg );
+		} else {
+			
+			$result['status'] = true;
 
-		return $result;
+			if(!imap_deletemailbox($mbox_stream,"{".$imap_server."}$nameBox")){
+				$result = array( "status" => false, "error" => imap_last_error() );
+			}
+
+			if($mbox_stream){ $this->close_mbox($mbox_stream); }
+
+			return $result;
+		}
 	}
 
 	function ren_mailbox($arr)
diff --git a/expressoMail1_2/js/TreeShow.js b/expressoMail1_2/js/TreeShow.js
index eeadc9a..2290758 100755
--- a/expressoMail1_2/js/TreeShow.js
+++ b/expressoMail1_2/js/TreeShow.js
@@ -80,7 +80,6 @@ var ttreeBox = new function()
 		
 		for ( var i=0 ; i < arr_nm_folder.length; i++ ) {
 			if ( name_folder == arr_nm_folder[i] ) {
-				ttree.FOLDER = '';
 				return true;
 			}
 		}
@@ -90,72 +89,67 @@ var ttreeBox = new function()
 	// Valida os nomes das pastas
 	this.validate = function( func )
 	{
-		var aux = ttree.FOLDER.split( cyrus_delimiter );
-		var aux2;
-		if ( ttree.FOLDER != "" ) {
+		if( $.trim(ttree.FOLDER) !== "" ){
 			
-			if ( aux.length > 1 ) aux2 = aux[1];
-			else aux2 = aux[0];
+			let folderName = ttree.FOLDER.split( cyrus_delimiter ).pop();
 			
-			if ( func == 'rename' && this.verify_names( aux2 ) ) {
-				
-				alert( get_lang( 'It\'s not possible rename the folder: ')+lang_folder( aux2 )+'.' );
-				return false;
+			let newFolder = "";
+
+			if( func === "rename" ){
+
+				if ( this.verify_names( folderName ) ) {
+					alert( get_lang( 'It\'s not possible rename the folder: ') + lang_folder( folderName ) + '.' );
+					return false;
+				}
+
+				if ( ttree.FOLDER == 'root' ) {
+					alert( get_lang( 'It\'s not possible rename this folder!' ) );
+					return false;
+				}
 				
+				if ( $.trim(ttree.FOLDER) === $.trim(get_current_folder()) ) {
+					alert( get_lang(
+						'It\'s not possible rename this folder, because it is being used in the moment!'
+					) );
+					return false;
+				}
+
+				newFolder = prompt( get_lang( 'Enter a name for the box'), '' );
+
 			} else {
+
+				newFolder = prompt( get_lang( 'Enter the name of the new folder:' ), '' );
+			}
+
+			newFolder = $.trim( newFolder );
+
+			if( newFolder !== "" ){
 				
-				if ( func == 'newpast' ) {
-					var button = prompt( get_lang( 'Enter the name of the new folder:' ), '' );
-					
-					if ( button.indexOf( 'local_' ) != -1  || button.toUpperCase() == 'INBOX' ) {
-						alert( get_lang( 'cannot create folder. try other folder name' ) );
-						//Não posso criar pastas contendo a string local_
-						return false;
-					}
-					
-					if ( button.match( /[\/\\\!\@\#\$\%\&\*\(\)]/gi ) ) {
-						alert( get_lang( 'cannot create folder. try other folder name' ) );
-						return false;
-					}
-					
-					if ( trim( button ) == '' || trim( button ) == null ) return false;
-					else ttreeBox.new_past(button);
-					
+				if ( newFolder.indexOf( 'local_' ) > -1 ) {
+					alert( get_lang( 'cannot create folder. try other folder name' ) );
+					return false;
 				}
 				
-				if ( func == 'rename' ) {
-					
-					if ( ttree.FOLDER == 'root' ) {
-						alert( get_lang( 'It\'s not possible rename this folder!' ) );
-						return false;
-					}
-					
-					if ( ttree.FOLDER == get_current_folder() ) {
-						alert( get_lang(
-							'It\'s not possible rename this folder, because it is being used in the moment!'
-						) );
-						return false;
-					}
-					
-					var button1 = prompt( get_lang( 'Enter a name for the box'), '' );
-					if ( button1.indexOf( 'local_' ) != -1 || button1.toUpperCase() == 'INBOX' ) {
-						alert( get_lang( 'cannot create folder. try other folder name' ) );
-						//Não posso criar pastas contendo a string local_
-						return false;
-					}
-					
-					if ( button1.match( /[\/\\\!\@\#\$\%\&\*\(\)]/gi ) ) {
-						alert( get_lang( 'It\'s not possible rename this folder. try other folder name' ) );
-						return false;
-					}
-					
-					if ( trim( button1 ) == '' || trim( button1 ) == null ) return false;
-					else ttreeBox.rename(button1);
+				if ( newFolder.match( /(INBOX|inbox|Caixa de Entrada)/gi ) ) {
+					alert( get_lang( 'NOME INVALIDO' ) );
+					return false;
+				}
+
+				if ( newFolder.match( /[\/\\\!\@\#\$\%\&\*\(\)]/gi ) ) {
+					alert( get_lang( 'Caracteres inválidos' ) );
+					return false;
+				}
+
+				if( func === "rename" ){
+					ttreeBox.rename( newFolder );
+				} else {
+					ttreeBox.new_past( newFolder );
 				}
+			} else {
+				return false;
 			}
 		} else {
-			alert( get_lang( 'Select a folder!' ) );
-			return false;
+			alert( get_lang( 'Select a folder!' ) ); return false;
 		}
 	}
 	
diff --git a/expressoMail1_2/js/main.js b/expressoMail1_2/js/main.js
index 53f7af6..abbe638 100644
--- a/expressoMail1_2/js/main.js
+++ b/expressoMail1_2/js/main.js
@@ -841,6 +841,8 @@ function move_msgs2(folder, msgs_number, border_ID, new_folder, new_folder_name,
 			if( data.error ) {
 				if( ( new RegExp("Permission denied") ).test( data.error ) ){ 
 					alert( get_lang("You don't have permission for this operation!") ); 
+				} else if( ( new RegExp("Mailbox does not exist") ).test( data.error ) ){ 
+					alert( get_lang("Mailbox does not exist")  + " : " + new_folder_name );
 				} else {
 					alert( get_lang('Error moving message.') + " :\n " + data.error );
 				}
diff --git a/expressoMail1_2/setup/phpgw_pt-br.lang b/expressoMail1_2/setup/phpgw_pt-br.lang
index 74a3e69..6dc7a1e 100755
--- a/expressoMail1_2/setup/phpgw_pt-br.lang
+++ b/expressoMail1_2/setup/phpgw_pt-br.lang
@@ -285,6 +285,7 @@ italic	expressoMail1_2	pt-br	Italico
 It allow you to remove attachments from messages	expressoMail1_2	pt-br	Permite que você remova anexos de mensagens
 It allow you to send emails with important flag, but you can receive unwanted messages with important flag	expressoMail1_2	pt-br	Ela permite que você envie e-mails com sinalização de importante, mas você pode receber mensagens indesejadas com sinalização de importante
 It's not possible create inside: 	expressoMail1_2	pt-br	Não é possivel criar dentro de: 
+It's not possible delete the selected folder	expressoMail1_2	pt-br	Não é possível remover a pasta selecionada 
 It's not possible delete the folder: 	expressoMail1_2	pt-br	Não é possível remover a pasta: 
 It's not possible delete this folder, because it is being used in the moment!	expressoMail1_2	pt-br	Não é possível remover esta pasta, pois está em uso no momento!
 It's not possible remove this folder, because it is being used in the moment!	expressoMail1_1	pt-br	Não é possível remover esta pasta, pois estão em uso no momento!
@@ -319,6 +320,7 @@ Logoff	expressoMail1_2	pt-br	Desconectar
 l_seen	expressoMail1_2	pt-br	Lidas
 l_unseen	expressoMail1_2	pt-br	Não lidas
 Mailbox already exists	expressoMail1_2	pt-br	Pasta já existe.
+Mailbox does not exist	expressoMail1_2	pt-br	Pasta não existe
 Mailbox in migration	expressoMail1_2	pt-br	Caixa postal em migração
 Mailbox Sharing	expressoMail1_2	pt-br	Compartilhamento de Caixa Postal
 Mail	expressoMail1_2	pt-br	Correio
