Index: sandbox/2.4.3-expresso-rest/INSTALL/debian/squeeze/etc/postfix/main.cf
===================================================================
--- sandbox/2.4.3-expresso-rest/INSTALL/debian/squeeze/etc/postfix/main.cf	(revision 5883)
+++ sandbox/2.4.3-expresso-rest/INSTALL/debian/squeeze/etc/postfix/main.cf	(revision 7304)
@@ -76,5 +76,5 @@
 grupos_chase_referral = 0
 grupos_search_base = $ldapbase
-grupos_query_filter = (&(cn=%u)(objectClass=posixGroup)(phpgwAccountType=g))
+grupos_query_filter = (&(mail=%u)(objectClass=posixGroup)(phpgwAccountType=g))
 grupos_bind = no
 grupos_domain = hash:/etc/postfix/expresso-dominios
Index: sandbox/2.4.3-expresso-rest/INSTALL/expressoInstall.sh
===================================================================
--- sandbox/2.4.3-expresso-rest/INSTALL/expressoInstall.sh	(revision 7118)
+++ sandbox/2.4.3-expresso-rest/INSTALL/expressoInstall.sh	(revision 7304)
@@ -89,7 +89,7 @@
 # Inicia a escolha/instalacao e configuracao dos servicos nessarios ao ExpressoLivre
 SERVICOS=$( dialog --backtitle "$BACKTITLE" --stdout --separate-output \
-	--checklist 'Por favor, selecione quais servicos serao instalados neste sistema operacional:' 14 75 14 \ 
- 	http 'Servidor http (apache) juntamente com os modulos do PHP5' on \ 
-	ldap 'Servidor ldap (openldap)' on \
+	--checklist 'Por favor, selecione quais servicos serao instalados neste sistema operacional:' 14 75 14 \
+	http 'Servidor http (apache) juntamente com os modulos do PHP5' on \
+        ldap 'Servidor ldap (openldap)' on \
 	bd 'Servidor de banco de dados (postgresql)' on \
 	smtp 'Sevirdor smtp (postfix)' on \
Index: sandbox/2.4.3-expresso-rest/INSTALL/arquivos/scripts/aux.sh
===================================================================
--- sandbox/2.4.3-expresso-rest/INSTALL/arquivos/scripts/aux.sh	(revision 6261)
+++ sandbox/2.4.3-expresso-rest/INSTALL/arquivos/scripts/aux.sh	(revision 7304)
@@ -58,4 +58,9 @@
 }
 
+log_erro ()
+{
+	echo "$1"
+}
+
 qualSO ()
 {
@@ -107,7 +112,4 @@
 }
 
-qualSO
-echo $OSSTR
-
 validaSO ()
 {
Index: sandbox/2.4.3-expresso-rest/INSTALL/arquivos/scripts/http.sh
===================================================================
--- sandbox/2.4.3-expresso-rest/INSTALL/arquivos/scripts/http.sh	(revision 7058)
+++ sandbox/2.4.3-expresso-rest/INSTALL/arquivos/scripts/http.sh	(revision 7304)
@@ -26,8 +26,8 @@
 	get_org
 	# Faz backup do hosts
-	cp -f /etc/hosts /etc/hosts.`date "+%s"`
+	cp -f /etc/hosts /etc/hosts.`date "+%s"` || log_erro "Erro ao copiar o /etc/hosts!"
 	NOVOHOSTS=`mktemp`
 	echo "127.0.0.1 $DOMAIN localhost `hostname`" > $NOVOHOSTS
-	cat /etc/hosts >> $NOVOHOSTS
+	cat /etc/hosts >> $NOVOHOSTS || log_erro "Erro ao agregar o /etc/hosts!"
 	mv -f $NOVOHOSTS /etc/hosts
 	
@@ -52,5 +52,5 @@
 	apt-get install -y apache2-mpm-prefork libapache2-mod-php5 apache2-utils \
 		php5 php5-common php5-dev php5-gd php5-imap php5-ldap php5-pgsql php5-cgi php5-cli php5-curl php5-xmlrpc php5-memcache php5-pspell \
-		libgv-php5 zip unzip memcached libmemcached5
+		libgv-php5 zip unzip memcached
 	# Copia os arquivos do Expresso Livre
 	cpexpresso "/var/www"
@@ -69,4 +69,6 @@
 {
 	http_debian
+	# O nome do pacote do memcache no Debian Ã© diferente do Ubuntu
+	apt-get -y install libmemcached5 || log_erro "Pacote nao encontrado"
 	# Copia a configuraÃ§Ã£o do servidor apache2
 	cp -a debian/squeeze/etc/apache2/apache2.conf /etc/apache2/
@@ -87,4 +89,6 @@
 {
 	http_debian_6
+	# O nome do pacote do memcache no Debian Ã© diferente do Ubuntu
+	apt-get -y install libmemcached6
 	cp -a ubuntu/11.10/.htaccess $DIR_EXPRESSO
         cp -a ubuntu/11.10/etc/apache2/apache2.conf /etc/apache2/
Index: sandbox/2.4.3-expresso-rest/INSTALL/arquivos/scripts/bd.sh
===================================================================
--- sandbox/2.4.3-expresso-rest/INSTALL/arquivos/scripts/bd.sh	(revision 6261)
+++ sandbox/2.4.3-expresso-rest/INSTALL/arquivos/scripts/bd.sh	(revision 7304)
@@ -18,7 +18,6 @@
 	
 	rm -rf $DIR_PG*
-	su - postgres -c "env LANG=pt_BR.ISO-8859-1 initdb --encoding=LATIN1 -D $DIR_PG"
-	#su - postgres -c "export LANG=pt_BR.ISO-8859-1; initdb --encoding=LATIN1 -D $DIR_PG"
-	#su - postgres -c "env LANG=LATIN1 initdb --locale=pt_BR.iso88591 --encoding=LATIN1 -D $DIR_PG"
+	su - postgres -c "env LC_ALL=C initdb --encoding=LATIN1 -D $DIR_PG"
+	#su - postgres -c "env LANG=pt_BR.ISO-8859-1 initdb --encoding=LATIN1 -D $DIR_PG"
 	sed -e "s/LDAP_DN/$LDAP_DN/g" -e "s/LDAP_PWD/$LDAP_PWD/g" -e "s/ou=ORG/ou=$ORG/g" -e "s/DOMAIN/$DOMAIN/g" $ARQS/expresso.dump > /tmp/expresso.dump
 	
@@ -31,6 +30,6 @@
 create_db ()
 {
-	su - postgres -c 'dropdb expresso'  || { echo "Banco expresso nÃ£o existia. [OK]"; }
-	su - postgres -c 'createdb -E LATIN1 expresso'  || { echo "Falha na criaÃ§Ã£o do banco expresso."; exit 1; }
+	su - postgres -c 'dropdb expresso'  || { echo "Banco expresso nao existia. [OK]"; }
+	su - postgres -c 'createdb -E LATIN1 expresso'  || { echo "Falha na criacao do banco expresso."; exit 1; }
 	su - postgres -c 'psql -f /tmp/expresso.dump expresso'
 }
@@ -91,6 +90,5 @@
 
         bd $DIR_PG $PG_CONF $PG_HBA $DIR_CONF
-        #rm -f $DIR_PG/postgresql.conf
-        #rm -f $DIR_PG/pg_hba.conf
+        #rm -f $DIR_PG/{postgresql.conf,pg_hba.conf}
         /etc/init.d/postgresql start
 
Index: sandbox/2.4.3-expresso-rest/INSTALL/rhel/6/etc/postfix/main.cf
===================================================================
--- sandbox/2.4.3-expresso-rest/INSTALL/rhel/6/etc/postfix/main.cf	(revision 5883)
+++ sandbox/2.4.3-expresso-rest/INSTALL/rhel/6/etc/postfix/main.cf	(revision 7304)
@@ -76,5 +76,5 @@
 grupos_chase_referral = 0
 grupos_search_base = $ldapbase
-grupos_query_filter = (&(cn=%u)(objectClass=posixGroup)(phpgwAccountType=g))
+grupos_query_filter = (&(mail=%u)(objectClass=posixGroup)(phpgwAccountType=g))
 grupos_bind = no
 grupos_domain = hash:/etc/postfix/expresso-dominios
Index: sandbox/2.4.3-expresso-rest/jabberit_messenger/jmessenger/js/connector.mini.js
===================================================================
--- sandbox/2.4.3-expresso-rest/jabberit_messenger/jmessenger/js/connector.mini.js	(revision 3102)
+++ sandbox/2.4.3-expresso-rest/jabberit_messenger/jmessenger/js/connector.mini.js	(revision 7304)
@@ -1,5 +1,15 @@
 
 (function()
-{var _THREADS=[];var _ie;function _config(pObj,pEvent,pHandler)
+{
+if (document.all){
+navigator.userAgent.toLowerCase().indexOf('msie 5') != -1 ? is_ie5 = true : is_ie5 = false;
+is_ie = true;is_moz1_6 = false;is_mozilla = false;is_webkit = false;is_ns4 = false;}
+else if (document.getElementById){
+navigator.userAgent.toLowerCase().match('mozilla.*rv[:]1\.6.*gecko') ? is_moz1_6 = true : is_moz1_6 = false;
+navigator.userAgent.toLowerCase().match('applewebkit') ? is_webkit = true : is_webkit = false;
+is_ie = false;is_ie5 = false;is_mozilla = true;is_ns4 = false;}
+else if (document.layers)
+{is_ie = false;is_ie5 = falseis_moz1_6 = false;is_mozilla = false;is_webkit = false;is_ns4 = true;}	
+var _THREADS=[];var _ie;function _config(pObj,pEvent,pHandler)
 {if(typeof pObj=='object')
 {if(pEvent.substring(0,2)=='on')
Index: sandbox/2.4.3-expresso-rest/prototype/services/ImapServiceAdapter.php
===================================================================
--- sandbox/2.4.3-expresso-rest/prototype/services/ImapServiceAdapter.php	(revision 7044)
+++ sandbox/2.4.3-expresso-rest/prototype/services/ImapServiceAdapter.php	(revision 7304)
@@ -600,6 +600,10 @@
 				$msg_uid = $data['msg_id'];
 				$body = $data['body'];
+				$body = str_replace("&lt;","&yzwkx;",$body); //Alterar as Entities padrão das tags < > para compatibilizar com o Expresso
+				$body = str_replace("&gt;","&xzwky;",$body);
 				$body = str_replace("%nbsp;","&nbsp;",$body);
-				$body = html_entity_decode ( $body, ENT_QUOTES , 'ISO-8859-1' );					
+				$body = html_entity_decode ( $body, ENT_QUOTES , 'ISO-8859-1' );		
+				$body = str_replace("&yzwkx;","&lt;",$body);
+				$body = str_replace("&xzwky;","&gt;",$body);				
 
 				$folder = mb_convert_encoding($data['folder'], "UTF7-IMAP","ISO-8859-1, UTF-8");
Index: sandbox/2.4.3-expresso-rest/prototype/rest/catalog/DynamicContactsResource.php
===================================================================
--- sandbox/2.4.3-expresso-rest/prototype/rest/catalog/DynamicContactsResource.php	(revision 6783)
+++ sandbox/2.4.3-expresso-rest/prototype/rest/catalog/DynamicContactsResource.php	(revision 7304)
@@ -45,4 +45,5 @@
 	    }
 
+	    $dynamicContacts = array_slice($dynamicContacts, 0,50);
 	    foreach ($dynamicContacts as $value) {
 		$d = new Data();
Index: sandbox/2.4.3-expresso-rest/workflow/inc/local/classes/class.wf_orgchart.php
===================================================================
--- sandbox/2.4.3-expresso-rest/workflow/inc/local/classes/class.wf_orgchart.php	(revision 7273)
+++ sandbox/2.4.3-expresso-rest/workflow/inc/local/classes/class.wf_orgchart.php	(revision 7304)
@@ -146,4 +146,5 @@
 				 "       a.area_id, " .
 				 "       a.sigla AS area_sigla, " .
+				 "       a.descricao AS area_descricao, " .
 				 "       c.centro_custo_id, " .
 				 "       c.nm_centro_custo, " .
Index: sandbox/2.4.3-expresso-rest/expressoMail1_2/templates/default/main.css
===================================================================
--- sandbox/2.4.3-expresso-rest/expressoMail1_2/templates/default/main.css	(revision 7273)
+++ sandbox/2.4.3-expresso-rest/expressoMail1_2/templates/default/main.css	(revision 7304)
@@ -1468,4 +1468,7 @@
 }
 
+.none-selected{
+	color: #9F9F9F;
+}
 .selected_shortcut_msg{
     color: white;
@@ -1578,3 +1581,4 @@
 	overflow: hidden;
 	vertical-align: middle;
-}
+	cursor: text;
+}
Index: sandbox/2.4.3-expresso-rest/expressoMail1_2/inc/class.imap_functions.inc.php
===================================================================
--- sandbox/2.4.3-expresso-rest/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 7273)
+++ sandbox/2.4.3-expresso-rest/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 7304)
@@ -2649,5 +2649,5 @@
 	}
 	
-	function send_mail($params) { 
+	function send_mail($params) {
             require_once dirname(__FILE__) . '/../../services/class.servicelocator.php';
             require_once dirname(__FILE__) . '/../../prototype/api/controller.php';
@@ -2658,5 +2658,5 @@
             $fromaddress = $params['input_from'] ? explode(';', $params['input_from']) : "";
             $message_attachments_contents = (isset($params['message_attachments_content'])) ? $params['message_attachments_content'] : false;
-
+			
             ##
             # @AUTHOR Rodrigo Souza dos Santos
@@ -2674,4 +2674,17 @@
             }
 
+			$params['input_to'] = mb_convert_encoding($params['input_to'], "ISO-8859-1","UTF-8, ISO-8859-1");
+			$params['input_cc'] = mb_convert_encoding($params['input_cc'], "ISO-8859-1","UTF-8, ISO-8859-1");
+			$params['input_cco'] = mb_convert_encoding($params['input_cco'], "ISO-8859-1","UTF-8, ISO-8859-1");
+
+            if (substr($params['input_to'], -1) == ',')
+                $params['input_to'] = substr($params['input_to'], 0, -1);
+
+            if (substr($params['input_cc'], -1) == ',')
+                $params['input_cc'] = substr($params['input_cc'], 0, -1);
+
+            if (substr($params['input_cco'], -1) == ',')
+                $params['input_cco'] = substr($params['input_cco'], 0, -1);
+
             /*Wraps the text dividing the emails as from ">,"*/
             $toaddress = $db->getAddrs(preg_split('/>,/',preg_replace('/>,/', '>>,', $params['input_to'])));
@@ -2701,5 +2714,5 @@
 
             $replytoaddress = $params['input_reply_to'];
-            $subject = $params['input_subject'];
+            $subject = mb_convert_encoding($params['input_subject'], "ISO-8859-1","UTF-8, ISO-8859-1");
             $return_receipt = $params['input_return_receipt'];
             $is_important = $params['input_important_message'];
@@ -2710,12 +2723,5 @@
             $message_attachments = $params['message_attachments'];
 
-            if (substr($params['input_to'], -1) == ',')
-                $params['input_to'] = substr($params['input_to'], 0, -1);
-
-            if (substr($params['input_cc'], -1) == ',')
-                $params['input_cc'] = substr($params['input_cc'], 0, -1);
-
-            if (substr($params['input_cco'], -1) == ',')
-                $params['input_cco'] = substr($params['input_cco'], 0, -1);
+
 
             // Valida numero Maximo de Destinatarios 
@@ -2834,5 +2840,5 @@
             } else {
                 //Compatibilização com Outlook, ao encaminhar a mensagem
-                $body = mb_ereg_replace('<!--\[', '<!-- [', $params['body']);				
+                $body = mb_ereg_replace('<!--\[', '<!-- [', base64_decode($params['body']));
 				$body = str_replace("&lt;","&yzwkx;",$body); //Alterar as Entities padrão das tags < > para compatibilizar com o Expresso
 				$body = str_replace("&gt;","&xzwky;",$body);
@@ -2884,11 +2890,8 @@
             }
 
-
-            if ($fromaddress)
-                $mailService->setFrom('"' . $fromaddress[0] . '" <' . $fromaddress[1] . '>');
-            else
-                $mailService->setFrom('"' . $_SESSION['phpgw_info']['expressomail']['user']['firstname'] . ' ' . $_SESSION['phpgw_info']['expressomail']['user']['lastname'] . '" <' . $_SESSION['phpgw_info']['expressomail']['user']['email'] . '>');
-            
-            $mailService->addHeaderField('Reply-To', $replytoaddress);
+			$from = $fromaddress ?  ('"' . $fromaddress[0] . '" <' . $fromaddress[1] . '>') : ('"' . $_SESSION['phpgw_info']['expressomail']['user']['firstname'] . ' ' . $_SESSION['phpgw_info']['expressomail']['user']['lastname'] . '" <' . $_SESSION['phpgw_info']['expressomail']['user']['email'] . '>');
+			$mailService->setFrom($from);				
+        
+			$mailService->addHeaderField('Reply-To', !!$replytoaddress ? $replytoaddress : $from);
 
             $bol = $this->add_recipients('to', $toaddress, $mailService);
@@ -3016,5 +3019,5 @@
 
             $attachment = json_decode($params['attachments'],TRUE);
-
+            $message_size_total = 0;
             foreach ($attachment as &$value) 
             {
Index: sandbox/2.4.3-expresso-rest/expressoMail1_2/js/common_functions.js
===================================================================
--- sandbox/2.4.3-expresso-rest/expressoMail1_2/js/common_functions.js	(revision 7145)
+++ sandbox/2.4.3-expresso-rest/expressoMail1_2/js/common_functions.js	(revision 7304)
@@ -1148,5 +1148,5 @@
 					var info = "Todas as <b>"+totalFolderMsgs+"</b> mensagens "+filterFlag+" em "+folder+" foram selecionadas. "+link;
 					div.html("<span>"+info+"<span>");
-					div.show();
+					//div.show();
 					$('.select-link').bind('click',function(){
 						selectAllFolderMsgs();
@@ -1159,5 +1159,5 @@
 			var info = "Todas as <b>"+$('#table_box tr').length+"</b> mensagens desta página foram selecionadas. "+link;
 			div.html("<span>"+info+"<span>");
-			div.show();
+			//div.show();
 			$('.select-link').bind('click',function(){
 				selectAllFolderMsgs(true);
@@ -1190,6 +1190,5 @@
 			});			
 		}
-		else div.hide();
-		
+		else div.html('<span class="none-selected">Nenhuma mensagem foi selecionada.</span>');		
 	}
 	resizeWindow();
Index: sandbox/2.4.3-expresso-rest/expressoMail1_2/js/main.js
===================================================================
--- sandbox/2.4.3-expresso-rest/expressoMail1_2/js/main.js	(revision 7273)
+++ sandbox/2.4.3-expresso-rest/expressoMail1_2/js/main.js	(revision 7304)
@@ -2858,4 +2858,5 @@
 	if (preferences.auto_save_draft == 1)
 	   autoSaveControl.status[ID] = true;
+
 	var content = $("#content_id_"+ID);
 	var save_link = $("#content_id_"+ID).find(".save");
@@ -2864,92 +2865,10 @@
 	save_link.button({disabled: true});
 
-	ID_tmp = ID;
-
-	var handler_send_message = function(data){
-		send_message_return(data, this.ID_tmp); // this is a hack to escape quotation form connector bug
-	};
-
-        var mail_as_plain = document.getElementById( 'textplain_rt_checkbox_' + ID );
-	mail_as_plain = ( mail_as_plain ) ? mail_as_plain.checked : false;
-
-       var content_body  = RichTextEditor.getData('body_'+ID);        
-	var textArea = document.createElement("TEXTAREA");
-	textArea.style.display='none';
-	textArea.name = "body";
-	textArea.value = content_body;
-   
-	var input_folder = document.createElement("INPUT");
-	input_folder.style.display='none';
-	input_folder.name = "folder";
-	input_folder.value = folder;      
-	
-	var input_type = document.createElement("INPUT"); 
-	input_type.style.display='none'; 
-	input_type.name = "type"; 
-	input_type.value = RichTextEditor.plain[ID] ? 'plain' : 'html'; 
-	
-        var uids = document.createElement("INPUT");
-	uids.style.display='none';
-	uids.name = "uids_save";
-	uids.value = uidsSave[ID].toString();
-        
-        var save_folder = document.createElement("INPUT");
-	save_folder.style.display='none';
-	save_folder.name = "save_folder";
-	save_folder.value = (openTab.imapBox[ID] && openTab.type[ID] < 6) ? openTab.imapBox[ID]: "INBOX" + cyrus_delimiter + draftsfolder;
-        
-        var msg_attachments = document.createElement("INPUT");
-	msg_attachments.style.display='none';
-	msg_attachments.name = "attachments";
-	msg_attachments.value = listAttachment(ID);
-
-	if (is_ie){
-		var i = 0;
-		while (document.forms(i).name != "form_message_"+ID){i++}
-		form = document.forms(i);
-	}
-	else
-		form = document.forms["form_message_"+ID];
-
-		// Evita que e-mails assinados sejam enviados quando o usuário tenta enviar um e-mail
-		// não assinado (desmarcou a opção) após tentar enviar um e-mail assinado que não passou
-		// no teste de validação.
-		var checkSign = document.getElementById('return_digital_'+ID);
-		if (checkSign && !checkSign.checked){
-			var smime = Element('smime');
-			if (smime)
-			{
-				var parent = smime.parentNode;
-				parent.removeChild(smime);
-			}
-		 }
-
-	form.appendChild(textArea);
-	form.appendChild(input_folder);
-    form.appendChild(input_type);
-	// Implementação do In_Reply_To e References
-	var msgId = document.createElement("INPUT");
-	msgId.style.display = 'none';
-	msgId.name = 'messageNum';
-	msgId.value = currentTab;
-
-	form.appendChild(msgId);
-    form.appendChild(save_folder);
-    form.appendChild(uids);
-	form.appendChild(msg_attachments);
-
-        var mail_type = document.createElement('input');
-	mail_type.setAttribute('type', 'hidden');
-	mail_type.name = 'type';
-	mail_type.value = ( mail_as_plain ) ? 'plain' : 'html';
-        form.parentNode.appendChild(mail_type);
-
-	var _subject = trim(content.find(".subject").val());
-	if((_subject.length == 0) && !confirm(get_lang("Send this message without a subject?"))) {
-		save_link.click(onClick);
-		content.find(".subject").focus();
-		return;
-	}
-	//stringEmail = content.find('[name="input_to"]').val();
+    var _subject = trim(content.find(".subject").val());
+    if((_subject.length == 0) && !confirm(get_lang("Send this message without a subject?"))) {
+        save_link.click(onClick);
+        content.find(".subject").focus();
+        return;
+    }
 
     var stringReply = "";
@@ -2959,88 +2878,89 @@
     $.each(array, function(index, value){
         stringReply += $(value).find("input").val() + ",";
+    });	
+    var stringToEmail = "";
+    draw_email_box(content.find(".to-tr").find("textarea:first").val() || content.find(".to-tr").find("input:visible").val(), content.find(".to-tr").find("textarea:first"));
+    content.find(".to-tr").find("textarea:first").val("");
+    content.find(".to-tr").find("input:visible").val("");
+    var array = content.find(".to-tr").find(".box");
+    $.each(array, function(index, value){
+        stringToEmail += $(value).find("input").val() + ",";
     });
-    content.find('[name="input_reply_to"]').val(stringReply);
-
-	var stringEmail = "";
-	var stringToEmail = "";
-	draw_email_box(content.find(".to-tr").find("textarea:first").val() || content.find(".to-tr").find("input:visible").val(), content.find(".to-tr").find("textarea:first"));
-	content.find(".to-tr").find("textarea:first").val("");
-	content.find(".to-tr").find("input:visible").val("");
-	var array = content.find(".to-tr").find(".box");
-	$.each(array, function(index, value){
-		//stringEmail += $(value).find("input").val() + ",";
-		stringToEmail += $(value).find("input").val() + ",";
-	});
-	content.find('[name="input_to"]').val(stringToEmail);
-	stringEmail = stringToEmail;
-	var stringCCoEmail = "";
-	if ( content.find('[name="input_cco"]').length){
-		if(content.find(".cco-tr").css("display") != "none"){
-			draw_email_box(content.find(".cco-tr").find("textarea:first").val() || content.find(".cco-tr").find("input:visible").val(), content.find(".cco-tr").find("textarea:first"));
-			content.find(".cco-tr").find("textarea:first").val("");
-			content.find(".cco-tr").find("input:visible").val("");
-			var array = content.find(".cco-tr").find(".box");
-			$.each(array, function(index, value){
-				//stringEmail += $(value).find("input").val() + ",";
-				stringCCoEmail += $(value).find("input").val() + ",";
-			});
-			content.find('[name="input_cco"]').val(stringCCoEmail);
-		}
-	}
-	stringEmail += stringCCoEmail;
-	var stringCCEmail = "";		
-	if(content.find(".cc-tr").css("display") != "none")
-	{
-		draw_email_box(content.find(".cc-tr").find("textarea:first").val() || content.find(".cc-tr").find("input:visible").val(), content.find(".cc-tr").find("textarea:first"));
-		content.find(".cc-tr").find("textarea:first").val("");
-		content.find(".cc-tr").find("input:visible").val("");
-		var array = content.find(".cc-tr").find(".box");
-		$.each(array, function(index, value){
-			//stringEmail += $(value).find("input").val() + ",";
-			stringCCEmail += $(value).find("input").val() + ",";
+    var stringEmail = "";
+    stringEmail = stringToEmail;
+    var stringCCoEmail = "";
+    if ( content.find('[name="input_cco"]').length){
+        if(content.find(".cco-tr").css("display") != "none"){
+            draw_email_box(content.find(".cco-tr").find("textarea:first").val() || content.find(".cco-tr").find("input:visible").val(), content.find(".cco-tr").find("textarea:first"));
+            content.find(".cco-tr").find("textarea:first").val("");
+            content.find(".cco-tr").find("input:visible").val("");
+            var array = content.find(".cco-tr").find(".box");
+            $.each(array, function(index, value){
+                stringCCoEmail += $(value).find("input").val() + ",";
+            });
+        }
+    }
+    stringEmail += stringCCoEmail;
+    var stringCCEmail = "";
+    if(content.find(".cc-tr").css("display") != "none")
+    {
+        draw_email_box(content.find(".cc-tr").find("textarea:first").val() || content.find(".cc-tr").find("input:visible").val(), content.find(".cc-tr").find("textarea:first"));
+        content.find(".cc-tr").find("textarea:first").val("");
+        content.find(".cc-tr").find("input:visible").val("");
+        var array = content.find(".cc-tr").find(".box");
+        $.each(array, function(index, value){
+            stringCCEmail += $(value).find("input").val() + ",";
+        });
+    }
+    stringEmail += 	stringCCEmail;
+
+    var mailData = new Object();
+    mailData.body = Base64.encode(RichTextEditor.getData('body_'+ID));
+    mailData.folder = folder;
+    mailData.type = RichTextEditor.plain[ID] ? 'plain' : 'html';
+    mailData.uids_save = uidsSave[ID].toString();
+    mailData.save_folder = (openTab.imapBox[ID] && openTab.type[ID] < 6) ? openTab.imapBox[ID]: "INBOX" + cyrus_delimiter + draftsfolder;
+    mailData.attachments = listAttachment(ID);
+    mailData.messageNum = currentTab;
+    mailData.input_subject = trim(content.find(".subject").val());
+    mailData.input_reply_to = stringReply;
+    mailData.input_to = stringToEmail;
+    mailData.input_cco = stringCCoEmail;
+    mailData.input_cc = stringCCEmail;
+    mailData.input_cc = stringCCEmail;
+    mailData.abaID = $(content).find('[name="abaID"]').val();
+    mailData.input_important_message = $(content).find('input:checkbox:checked[name="input_important_message"]').val();
+    mailData.input_return_receipt = $(content).find('input:checkbox:checked[name="input_return_receipt"]').val();
+    mailData.msg_forward_from = $(content).find('[name="msg_forward_from"]').val();
+    mailData.msg_reply_from = $(content).find('[name="msg_reply_from"]').val();
+	
+	if ($(content).find('select[name="input_from"]').val())
+		mailData.input_from = $(content).find('select[name="input_from"]').val();
+
+
+	if(stringEmail != ""){
+		$.ajax({
+			url: "controller.php?action=$this.imap_functions.send_mail",
+            data:  mailData,
+            type: 'POST',
+	    	success: function(data){
+                send_message_return(connector.unserialize(data),ID);
+			},
+			error: function(){
+				write_msg("Erro ao tentar enviar a mensagem. Nova tentativa em alguns segundos...");
+				var interval = setInterval(function(){
+						send_valided_message(ID,folder,folder_name);
+						clearInterval(interval);
+				},15000);
+				return;
+			}
 		});
-		content.find('[name="input_cc"]').val(stringCCEmail);
-	}
-	stringEmail += 	stringCCEmail;
-	if (expresso_offline) {
-		
-		var invalidEmail = searchEmail(stringEmail);
-		if(content.find('[name="input_to"]').val()=="" && content.find('[name="input_cco"]').val()=="" && content.find('[name="input_cc"]').val()=="") {
-			write_msg(get_lang("message without receiver"));
-			return;
-		}else if(invalidEmail[0] == true){
-			write_msg("Os endereços de destinatário a seguir estão incorretos: "+invalidEmail[1]);
-			return;
-		}
-
-		sucess = expresso_local_messages.send_to_queue(form);
-		var data_return = new Array();
-		data_return.success = sucess;
-		handler_send_message(data_return,ID);
-	}
-	else{
-		if(stringEmail != ""){
-			$.ajax({			
-				url: "controller.php?",
-				success: function(data){
-					cExecuteForm("$this.imap_functions.send_mail", form, handler_send_message, ID);
-				},
-				error: function(){
-					write_msg("Erro ao tentar enviar a mensagem. Nova tentativa em alguns segundos...");
-					var interval = setInterval(function(){
-							send_valided_message(ID,folder,folder_name);
-							clearInterval(interval);
-					},15000);
-					return;
-				}
-			});			
-		}else{
-			write_msg(get_lang("message without receiver"));
-			return;
-		}
-	}
-
-}
-
+	}else{
+		write_msg(get_lang("message without receiver"));
+		return;
+	}
+
+
+}
 
 function is_valid_email(campo){	
Index: sandbox/2.4.3-expresso-rest/expressoMail1_2/js/draw_api.js
===================================================================
--- sandbox/2.4.3-expresso-rest/expressoMail1_2/js/draw_api.js	(revision 7273)
+++ sandbox/2.4.3-expresso-rest/expressoMail1_2/js/draw_api.js	(revision 7304)
@@ -1079,7 +1079,8 @@
 function drawSelectMsgsTable(){
 	var div = $('<div>');	
+	div.html('<span class="none-selected">Nenhuma mensagem foi selecionada.</span>');
 	div.attr('class','select-all-messages'); 
 	$('#content_id_0').first().prepend(div);
-	div.css('display','none');
+	//div.css('display','none');
 }
 
@@ -1164,7 +1165,10 @@
         });
 	}
+	else if (total_pages > 1){
+		div.html('<span class="none-selected">Nenhuma mensagem foi selecionada.</span>');
+	}
 	else{
 		div.hide();
-	} 
+	}  
     resizeWindow();
 }
@@ -1182,5 +1186,5 @@
 		var info = "Todas as <b>"+totalFolderMsgs+"</b> mensagens "+filterFlag+" em "+folder+" foram selecionadas. "+link;
 		div.html("<span>"+info+"<span>");
-		div.show();
+		//div.show();
 		$('.select-link').bind('click',function(){
             selectAllFolderMsgs();
@@ -1201,5 +1205,5 @@
 			selectedPagingMsgs[obj] = false;
 		}
-		div.hide();
+		div.html('<span class="none-selected">Nenhuma mensagem foi selecionada.</span>');
 	}
     resizeWindow();
@@ -4791,4 +4795,5 @@
 	}).end().end().end().filter(".message-attach-link").click(function(){
 		jQuery('#message-attach-dialog').html(DataLayer.render("../prototype/modules/attach_message/attach_message.ejs", {}));
+		var lastFolderSelected = $('#content_folders .folder.selected');
 		$( "#mailpreview_container span.ui-icon-close" ).click();
 		jQuery('#message-attach-dialog').dialog({
@@ -4802,4 +4807,5 @@
                 event.stopPropagation();
                  if(typeof(shortcut) != 'undefined') shortcut.disabled = false;
+                 lastFolderSelected.toggleClass('selected');
             },
             open: function(event, ui) 
