Index: /trunk/expressoMail1_2/index.php
===================================================================
--- /trunk/expressoMail1_2/index.php	(revision 5134)
+++ /trunk/expressoMail1_2/index.php	(revision 5229)
@@ -165,4 +165,10 @@
 	$template->set_var("msg_number",$_GET['msgball']['msgnum'] ? $_GET['msgball']['msgnum'] : $_GET['to']);
 	$template->set_var("user_email",$_SESSION['phpgw_info']['expressomail']['user']['email']);
+	include_once $_SESSION['rootPath'] . '/header.inc.php';
+	require_once $_SESSION['rootPath'] . '/API/class.servicelocator.php';
+	$alternativeMailService = ServiceLocator::getService('ldap');
+	$AlternateEmailExpresso = Array();
+	$AlternateEmailExpresso = $alternativeMailService->getMailAlternateByUidNumber($_SESSION['phpgw_info']['expressomail']['user']['account_id']);
+	$template->set_var("user_email_alternative", implode(",", $AlternateEmailExpresso));	
 	$acc = CreateObject('phpgwapi.accounts');
 	$template->set_var("user_organization", $acc->get_organization($GLOBALS['phpgw_info']['user']['account_dn']));
Index: /trunk/expressoMail1_2/templates/default/index.tpl
===================================================================
--- /trunk/expressoMail1_2/templates/default/index.tpl	(revision 5196)
+++ /trunk/expressoMail1_2/templates/default/index.tpl	(revision 5229)
@@ -6,4 +6,5 @@
 <input type="hidden" value="{msg_folder}" id="msg_folder">
 <input type="hidden" value="{msg_number}" id="msg_number">
+<input type="hidden" value="{user_email_alternative}" id="user_email_alternative">
 <input type="hidden" value="{user_email}" id="user_email">
 <input type="hidden" value="{user_organization}" id="user_organization">
Index: /trunk/expressoMail1_2/js/main.js
===================================================================
--- /trunk/expressoMail1_2/js/main.js	(revision 5221)
+++ /trunk/expressoMail1_2/js/main.js	(revision 5229)
@@ -1265,5 +1265,5 @@
  	    RichTextEditor.editorReady = false; 
 
-
+		
 		if (Element('show_img_link_'+border_ID))
 		{
@@ -1342,8 +1342,10 @@
 		if (document.getElementById("to_values_" + border_ID)){
 			data.to_all = document.getElementById("to_values_" + border_ID).value;
+			data.to_all_alternative = document.getElementById("user_email_alternative").value;
 			data.to_all = data.to_all.replace(/\n/gi," ");
 			data.to_all = data.to_all.replace(/&lt;/gi,"<");
 			data.to_all = data.to_all.replace(/&gt;/gi,">");
 			var _array_to_all = data.to_all.split(",");
+			var _array_to_alternative = data.to_all_alternative.split(",");
 		}
 	}
@@ -1443,4 +1445,10 @@
 				}
 			}
+			for(i = 0; i < _array_to_alternative.length; i++) {
+				for(k = 0; k < data.to_all.length; k++){
+					if(data.to_all[k].replace(/^\s+|\s+$/g,"") == _array_to_alternative[i])
+						data.to_all.splice( k , 1);
+				}
+			}
 			data.to_all = data.to_all.join(",");
 
@@ -1450,4 +1458,17 @@
 			Element("to_" + new_border_ID).value += ', ' + data.to_all;
 			if (data.cc){
+				data.cc = new Array();
+				var j = 0;
+				for(i = 0; i < _array_cc.length; i++) {
+					if(_array_cc[i].lastIndexOf(Element("user_email").value) == "-1"){
+						data.cc[j++] = _array_cc[i];
+					}
+				}
+				for(i = 0; i < _array_to_alternative.length; i++) {
+				for(k = 0; k < data.cc.length; k++){
+					if(data.cc[k].replace(/^\s+|\s+$/g,"") == _array_to_alternative[i])
+						data.cc.splice( k , 1);
+					}
+				}
 				Element("cc_" + new_border_ID).value = data.cc;
 				Element("a_cc_link_" + new_border_ID).style.display='none';
@@ -1483,10 +1504,17 @@
 				}
 			}
-                        if (data.to_all != get_lang("undisclosed-recipient"))
-                                data.to_all = data.to_all.join(",");
-                        else
+			for(i = 0; i < _array_to_alternative.length; i++) {
+				for(k = 0; k < data.to_all.length; k++){
+					if(data.to_all[k].replace(/^\s+|\s+$/g,"") == _array_to_alternative[i])
+						data.to_all.splice( k , 1);
+				}
+			} 
+			if (data.to_all != get_lang("undisclosed-recipient"))
+				data.to_all = data.to_all.join(",");
+			else
 				data.to_all = "";
 			title = "Re: " + data.subject;
 			Element("to_" + new_border_ID).value = data.to;
+			
 			Element("to_" + new_border_ID).value += ', ' + data.to_all;
 			
@@ -1495,12 +1523,18 @@
 			var j = 0;
 				for(i = 0; i < _array_cc.length; i++) {
-				if(_array_cc[i].lastIndexOf(Element("user_email").value) == "-1"){
-					data.cc[j++] = _array_cc[i];
-				}
-			}
-                        if (data.cc != get_lang("undisclosed-recipient"))
-                                data.cc = data.cc.join(",");
-                        else
-								data.cc = "";			
+					if(_array_cc[i].lastIndexOf(Element("user_email").value) == "-1"){
+						data.cc[j++] = _array_cc[i];
+					}
+				}
+				for(i = 0; i < _array_to_alternative.length; i++) {
+					for(k = 0; k < data.cc.length; k++){
+						if(data.cc[k].replace(/^\s+|\s+$/g,"") == _array_to_alternative[i])
+							data.cc.splice( k , 1);
+					}
+				}
+				if (data.cc != get_lang("undisclosed-recipient"))
+						data.cc = data.cc.join(",");
+				else
+						data.cc = "";			
 				document.getElementById("cc_" + new_border_ID).value = data.cc;
 				document.getElementById("a_cc_link_" + new_border_ID).style.display='none';
