=== modified file 'uc_file/uc_file.ca.inc'
--- uc_file/uc_file.ca.inc	2009-02-06 18:20:02 +0000
+++ uc_file/uc_file.ca.inc	2009-03-30 08:57:29 +0000
@@ -166,9 +166,7 @@ function uc_file_ca_trigger() {
  * The recipients, subject, and message fields take order token replacements.
  */
 function uc_file_action_order_email($order, $file_expiration, $settings) {
-
-  $account = user_load(array('uid' => $order->uid));
-  $language = language_default();
+  $account = uc_order_user_load($order);
 
   // Token replacements for the subject and body
   $settings['replacements'] = array(
@@ -187,7 +185,7 @@ function uc_file_action_order_email($ord
 
   // Send to each recipient.
   foreach ($recipients as $email) {
-    $sent = drupal_mail('uc_order', 'action-mail', $email, $language, $settings, $settings['from']);
+    $sent = drupal_mail('uc_order', 'action-mail', $email, uc_store_mail_recipient_language($email), $settings, $settings['from']);
 
     if (!$sent['result']) {
       watchdog('ca', 'Attempt to e-mail @email concerning order @order_id failed.', array('@email' => $email, '@order_id' => $order->order_id), WATCHDOG_ERROR);

=== modified file 'uc_order/uc_order.admin.inc'
--- uc_order/uc_order.admin.inc	2009-03-19 14:51:54 +0000
+++ uc_order/uc_order.admin.inc	2009-03-30 08:59:30 +0000
@@ -1496,16 +1496,9 @@ function uc_order_mail_invoice_form_subm
   }
 
   $recipient = check_plain($form_state['values']['email']);
-  $account = user_load(array('uid' => $order->uid));
-  if ($account->mail == $recipient) {
-    $language = user_preferred_language($account);
-  }
-  else {
-    $language = language_default();
-  }
-
+  
   $params = array('order' => $order);
-  $sent = drupal_mail('uc_order', 'invoice', $recipient, $language, $params);
+  $sent = drupal_mail('uc_order', 'invoice', $recipient, uc_store_mail_recipient_language($recipient), $params);
 
   if (!$sent) {
     drupal_set_message(t('E-mail failed.'));

=== modified file 'uc_order/uc_order.ca.inc'
--- uc_order/uc_order.ca.inc	2009-02-27 20:31:50 +0000
+++ uc_order/uc_order.ca.inc	2009-03-30 09:02:28 +0000
@@ -989,8 +989,7 @@ function uc_order_action_add_comment_for
  * The recipients, subject, and message fields take order token replacements.
  */
 function uc_order_action_email($order, $settings) {
-  $account = user_load(array('uid' => $order->uid));
-  $language = language_default();
+  $account = uc_order_user_load($order);
 
   // Token replacements for the subject and body
   $settings['replacements'] = array(
@@ -1010,7 +1009,7 @@ function uc_order_action_email($order, $
   }
 
   foreach ($recipients as $email) {
-    $sent = drupal_mail('uc_order', 'action-mail', $email, $language, $settings, empty($settings['from']) ? uc_store_email_from() : $settings['from']);
+    $sent = drupal_mail('uc_order', 'action-mail', $email, uc_store_mail_recipient_language($email), $settings, empty($settings['from']) ? uc_store_email_from() : $settings['from']);
 
     if (!$sent['result']) {
       watchdog('ca', 'Attempt to e-mail @email concerning order @order_id failed.', array('@email' => $email, '@order_id' => $order->order_id), WATCHDOG_ERROR);
@@ -1074,8 +1073,6 @@ function uc_order_action_email_form($for
  * The subject and addresses fields take order token replacements.
  */
 function uc_order_action_email_invoice($order, $settings) {
-  $language = user_preferred_language($account);
-
   // Token replacements for the subject and body
   $settings['replacements'] = array(
     'global' => NULL,
@@ -1099,7 +1096,7 @@ function uc_order_action_email_invoice($
 
 
   foreach ($recipients as $email) {
-    $sent = drupal_mail('uc_order', 'action-mail', $email, $language, $settings, empty($settings['from']) ? uc_store_email_from() : $settings['form']);
+    $sent = drupal_mail('uc_order', 'action-mail', $email, uc_store_mail_recipient_language($email), $settings, empty($settings['from']) ? uc_store_email_from() : $settings['form']);
 
     if (!$sent['result']) {
       watchdog('ca', 'Attempt to e-mail invoice for order @order_id to @email failed.', array('@email' => $email, '@order_id' => $order->order_id), WATCHDOG_ERROR);

=== modified file 'uc_order/uc_order.module'
--- uc_order/uc_order.module	2009-03-17 13:59:25 +0000
+++ uc_order/uc_order.module	2009-03-30 08:52:59 +0000
@@ -489,12 +489,14 @@ function uc_order_user($op, &$edit, &$ac
  * Implementation of hook_mail().
  */
 function uc_order_mail($key, &$message, $params) {
+  $langcode = isset($message['language']) ? $message['language']->language : NULL;
+  
   // Build the appropriate message paramaters based on the e-mail key.
   switch ($key) {
     // Setup an e-mailed invoice.
     case 'invoice':
       $message['headers']['Content-Type'] = 'text/html; charset=UTF-8; format=flowed';
-      $message['subject'] = t('Your Order Invoice');
+      $message['subject'] = t('Your Order Invoice', array(), $langcode);
       $message['from'] = uc_store_email_from();
       $message['body'][] = uc_order_load_invoice($params['order'], 'admin-mail', variable_get('uc_cust_order_invoice_template', 'customer'));
       break;

=== modified file 'uc_roles/uc_roles.ca.inc'
--- uc_roles/uc_roles.ca.inc	2009-01-30 21:29:16 +0000
+++ uc_roles/uc_roles.ca.inc	2009-03-30 09:04:23 +0000
@@ -290,8 +290,7 @@ function uc_roles_ca_trigger() {
  * The recipients, subject, and message fields take order token replacements.
  */
 function uc_roles_action_order_email($order, $role_expiration, $settings) {
-  $account = user_load(array('uid' => $order->uid));
-  $language = language_default();
+  $account = uc_order_user_load($order);
 
   // Token replacements for the subject and body
   $settings['replacements'] = array(
@@ -310,7 +309,7 @@ function uc_roles_action_order_email($or
 
   // Send to each recipient.
   foreach ($recipients as $email) {
-    $sent = drupal_mail('uc_order', 'action-mail', $email, $language, $settings, $settings['from']);
+    $sent = drupal_mail('uc_order', 'action-mail', $email, uc_store_mail_recipient_language($email), $settings, $settings['from']);
 
     if (!$sent['result']) {
       watchdog('ca', 'Attempt to e-mail @email concerning order @order_id failed.', array('@email' => $email, '@order_id' => $order->order_id), WATCHDOG_ERROR);
@@ -329,7 +328,7 @@ function uc_roles_action_order_email_for
  * The recipients, subject, and message fields take order token replacements.
  */
 function uc_roles_action_user_email($account, $role_expiration, $settings) {
-  $language = language_default();
+  $account = uc_order_user_load($order);
 
   // Token replacements for the subject and body
   $settings['replacements'] = array(
@@ -347,7 +346,7 @@ function uc_roles_action_user_email($acc
 
   // Send to each recipient.
   foreach ($recipients as $email) {
-    $sent = drupal_mail('uc_order', 'action-mail', $email, $language, $settings, $settings['from']);
+    $sent = drupal_mail('uc_order', 'action-mail', $email, uc_store_mail_recipient_language($email), $settings, $settings['from']);
 
     if (!$sent['result']) {
       watchdog('ca', 'Attempt to e-mail @email concerning order @order_id failed.', array('@email' => $email, '@order_id' => $order->order_id), WATCHDOG_ERROR);

=== modified file 'uc_stock/uc_stock.module'
--- uc_stock/uc_stock.module	2009-02-27 21:34:46 +0000
+++ uc_stock/uc_stock.module	2009-03-30 09:15:01 +0000
@@ -184,6 +184,8 @@ function _uc_stock_send_mail($order, $st
   $account = user_load(array('uid' => $order));
 
   $to = variable_get('uc_stock_threshold_notification_recipients', variable_get('uc_store_email', ini_get('sendmail_from')));
+  $to = explode(',', $to);
+  
   $from = uc_store_email_from();
 
   $subject = variable_get('uc_stock_threshold_notification_subject', uc_get_message('uc_stock_threshold_notification_subject'));
@@ -192,7 +194,14 @@ function _uc_stock_send_mail($order, $st
   $body = variable_get('uc_stock_threshold_notification_message', uc_get_message('uc_stock_threshold_notification_message'));
   $body = token_replace_multiple($body, $token_filters);
 
-  return drupal_mail('uc_stock', 'threshold', $to, user_preferred_language($account), array('body' => $body, 'subject' => $subject) , $from, TRUE);
+  // Send to each recipient.
+  foreach ($to as $email) {
+    $sent = drupal_mail('uc_stock', 'threshold', $email, uc_store_mail_recipient_language($email), array('body' => $body, 'subject' => $subject), $from);
+
+    if (!$sent['result']) {
+      watchdog('uc_stock', 'Attempt to e-mail @email concerning stock level on sku @sku failed.', array('@email' => $email, '@sku' => $stock->sku), WATCHDOG_ERROR);
+    }
+  }
 }
 
 /**

=== modified file 'uc_store/uc_store.module'
--- uc_store/uc_store.module	2009-03-19 17:15:57 +0000
+++ uc_store/uc_store.module	2009-03-30 09:05:51 +0000
@@ -1978,3 +2022,15 @@ function uc_store_image_widget_lightbox2
   return 'rel="'. $img_index .'"';
 }
 
+function uc_store_mail_recipient_language($address) {
+  // See if any user exists for this address.
+  $account = user_load(array('mail' => trim($address)));
+  if ($account) {
+    $lang_object = user_preferred_language($account);
+  }
+  // If not, site-wide default.
+  else {
+    $lang_object = language_default();
+  }
+  return $lang_object;
+}

