diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index f751711288c..8c81c0efc6a 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -146,9 +146,8 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO $sendtocc=''; $sendtobcc=''; $sendtoid = array(); - if (!empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) { - $sendtouserid=array(); - } + $sendtouserid=array(); + $sendtoccuserid=array(); // Define $sendto $receiver=$_POST['receiver']; @@ -179,18 +178,20 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO } } } - if (!empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) { + if (!empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) + { $receiveruser=$_POST['receiveruser']; if (is_array($receiveruser) && count($receiveruser)>0) { $fuserdest = new User($db); foreach($receiveruser as $key=>$val) { - $tmparray[] = $fuserdest->user_get_property($key,'email'); - $sendtouserid[] = $key; + $tmparray[] = $fuserdest->user_get_property($val,'email'); + $sendtouserid[] = $val; } } } + $sendto=implode(',',$tmparray); // Define $sendtocc @@ -222,15 +223,15 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO } } if (!empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) { - $receiveruser=$_POST['receiveccruser']; + $receiverccuser=$_POST['receiverccuser']; - if (is_array($receiveruser) && count($receiveruser)>0) + if (is_array($receiverccuser) && count($receiverccuser)>0) { $fuserdest = new User($db); - foreach($receiveruser as $key=>$val) + foreach($receiverccuser as $key=>$val) { - $tmparray[] = $fuserdest->user_get_property($key,'email'); - $sendtouserid[] = $key; + $tmparray[] = $fuserdest->user_get_property($val,'email'); + $sendtoccuserid[] = $val; } } } diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 555ad503693..5beae12a4fb 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -632,7 +632,7 @@ class FormMail extends Form if (! empty($this->withtouser) && is_array($this->withtouser) && !empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) { $out.= ''; - $out.= $langs->trans("MailToSalaries"); + $out.= $langs->trans("MailToUsers"); $out.= ''; // multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time @@ -698,7 +698,7 @@ class FormMail extends Form if (! empty($this->withtoccuser) && is_array($this->withtoccuser) && !empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) { $out.= ''; - $out.= $langs->trans("MailToCCSalaries"); + $out.= $langs->trans("MailToCCUsers"); $out.= ''; // multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time @@ -1112,7 +1112,7 @@ class FormMail extends Form elseif ($type_template=='thirdparty') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentThirdparty"); } elseif ($type_template=='user') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentUser"); } elseif (!empty($type_template)) { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContent".ucfirst($type_template)); } - + $ret->label = 'default'; $ret->lang = $outputlangs->defaultlang; $ret->topic = ''; diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index b155e2e4208..e80dd03b623 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -11,9 +11,9 @@ MailFrom=Sender MailErrorsTo=Errors to MailReply=Reply to MailTo=Receiver(s) -MailToSalaries=To salarie(s) +MailToUsers=To user(s) MailCC=Copy to -MailToCCSalaries=Copy to salarie(s) +MailToCCUsers=Copy to users(s) MailCCC=Cached copy to MailTopic=EMail topic MailText=Message