Index: branches/2.3/expressoMail1_2/setup/phpgw_pt-br.lang
===================================================================
--- branches/2.3/expressoMail1_2/setup/phpgw_pt-br.lang	(revision 5246)
+++ branches/2.3/expressoMail1_2/setup/phpgw_pt-br.lang	(revision 6340)
@@ -18,4 +18,6 @@
 all	expressoMail1_2	pt-br	Todas
 All messages are successfully unarchived	expressoMail1_2	pt-br	Mensagens desarquivadas com sucesso
+No messages were unarchived	expressoMail1_2	pt-br	Nenhuma mensagem foi desarquivada
+Some messages weren't successfully unarchived	expressoMail1_2	pt-br	Algumas mensagens não puderam ser desarquivadas
 Allowed domains for sieve forwarding	admin	pt-br	Domínios permitidos para encaminhamento em filtros
 Also check message against next rule	expressoMail1_2	pt-br	Checar mensagem contra próxima regra também
Index: branches/2.3/expressoMail1_2/inc/class.imap_functions.inc.php
===================================================================
--- branches/2.3/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 6264)
+++ branches/2.3/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 6340)
@@ -4056,4 +4056,10 @@
             imap_createmailbox($mbox_stream,imap_utf7_encode("{".$imap_server."}".$folder));
     	}
+        
+        // string date ( string $format [, int $timestamp = time() ] )
+        // bool imap_append ( resource $imap_stream , string $mailbox , string $message [, string $options = NULL [, string $internal_date = NULL ]] )
+        // 'd-M-Y H:i:s O'
+        
+        $return = array();
         if($timestamp){
             $tempDir = $_SESSION['phpgw_info']['server']['temp_dir'];
@@ -4067,4 +4073,15 @@
             $return['append'] = imap_append($mbox_stream, "{".$imap_server.":".$imap_port."}".$folder, $source, "\\Seen");
         }
+        
+        if (!empty($return['command']))
+        {
+            list ($result, $msg) = explode(':',$return['command']);
+            if (strtoupper($result) === 'NO')
+            {
+                $return['error'] = $msg;
+                return $return;
+            }
+        }
+        
         $status = imap_status($mbox_stream, "{".$this->imap_server.":".$this->imap_port."}".$folder, SA_UIDNEXT);
 
@@ -4182,5 +4199,7 @@
         $flags = explode("#@#@#@",$params['flags']);
         $ids = explode("#@#@#@",$params['id']);
-        $return = array(); 
+        $return = array();
+        $archived = array();
+        $error = array();
 
         foreach($sources as $index=>$src)
@@ -4190,8 +4209,23 @@
 		$source = $this->treat_base64_from_post($src);
 		$insert = $this->insert_email($source,$dest_folder,$timestamps[$index],$flags[$index]);
-                if(!$insert['error'])
-                    $return[] = $ids[$index];
+                if($insert['error'])
+                {
+                    $error[] = $ids[$index];
+                }
+                else 
+                {
+                    $archived[] = $ids[$index];
+                }
             }
 	}
+        
+        if (!empty($error))
+        {
+            $return['error'] = $error;
+        }
+        if (!empty($archived))
+        {
+            $return['archived'] = $archived;
+        }
         
         return $return;
Index: branches/2.3/expressoMail1_2/js/local_messages.js
===================================================================
--- branches/2.3/expressoMail1_2/js/local_messages.js	(revision 6264)
+++ branches/2.3/expressoMail1_2/js/local_messages.js	(revision 6340)
@@ -1239,10 +1239,22 @@
     var handler_unarchive = function(data)
     {
+        var archived = typeof (data.archived) == 'undefined' ? Array() : data.archived;
         if(preferences.keep_archived_messages == "0")
-             expresso_local_messages.delete_msgs(data.join());
+             expresso_local_messages.delete_msgs(archived.join());
         if(currentTab != 0)
-            delete_border(currentTab,'false'); 
-        write_msg(get_lang('All messages are successfully unarchived'));
-
+            delete_border(currentTab,'false');
+        
+        if (!data.error)
+        {
+            write_msg(get_lang('All messages are successfully unarchived'));
+        }
+        else if (!data.archived)
+            {
+                write_msg(get_lang('No messages were unarchived'));
+            }
+            else
+            {
+                write_msg(get_lang("Some messages weren't successfully unarchived"));
+            }
     }
 
Index: branches/2.3/expressoMail1_2/imap.py
===================================================================
--- branches/2.3/expressoMail1_2/imap.py	(revision 5227)
+++ branches/2.3/expressoMail1_2/imap.py	(revision 6340)
@@ -19,9 +19,15 @@
     M.login(user,password)
     flags=""
-    M.append(mailbox,flags,date_time,message)
+    data = M.append(mailbox,flags,date_time,message)
+
+    result = data[0]+':'+data[1][0]
+    
+    print result
+
     #print mailbox+flags+date_time+message
-    M.logout()
     #M.close()
-    print "no errors"
+    #print "no errors"
 except imaplib.IMAP4.error, erro:
     print erro
+finally:
+    M.logout()
