? system-actions-multiple-emails.patch
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.585.2.45
diff -u -p -r1.585.2.45 system.module
--- modules/system/system.module	16 Sep 2009 19:47:20 -0000	1.585.2.45
+++ modules/system/system.module	30 Nov 2009 14:56:53 -0000
@@ -1637,7 +1637,7 @@ function system_send_email_action_form($
     '#title' => t('Recipient'),
     '#default_value' => $context['recipient'],
     '#maxlength' => '254',
-    '#description' => t('The email address to which the message should be sent OR enter %author if you would like to send an e-mail to the author of the original post.', array('%author' => '%author')),
+    '#description' => t('The email address(es) to which the message should be sent OR enter %author if you would like to send an e-mail to the author of the original post. Use commas to separate multiple recipients.', array('%author' => '%author')),
   );
   $form['subject'] = array(
     '#type' => 'textfield',
@@ -1663,9 +1663,11 @@ function system_send_email_action_form($
 function system_send_email_action_validate($form, $form_state) {
   $form_values = $form_state['values'];
   // Validate the configuration form.
-  if (!valid_email_address($form_values['recipient']) && $form_values['recipient'] != '%author') {
-    // We want the literal %author placeholder to be emphasized in the error message.
-    form_set_error('recipient', t('Please enter a valid email address or %author.', array('%author' => '%author')));
+  foreach (explode(',', $form_values['recipient']) as $recipient) {
+    if (!valid_email_address(trim($recipient)) && trim($recipient) != '%author') {
+      // We want the literal %author placeholder to be emphasized in the error message.
+      form_set_error('recipient', t('Please enter a valid email address or %author.', array('%author' => '%author')));
+    }
   }
 }
 
@@ -1710,7 +1712,7 @@ function system_send_email_action($objec
       if (isset($context['node'])) {
         $node = $context['node'];
       }
-      elseif ($context['recipient'] == '%author') {
+      elseif (preg_match("/%author/", $context['recipient'])) {
         // If we don't have a node, we don't have a node author.
         watchdog('error', 'Cannot use %author token in this context.');
         return;
@@ -1727,9 +1729,7 @@ function system_send_email_action($objec
     if (!isset($account)) {
       $account = user_load(array('uid' => $node->uid));
     }
-    if ($recipient == '%author') {
-      $recipient = $account->mail;
-    }
+    $recipient = preg_replace('/%author/', $account->mail, $recipient);
   }
 
   if (!isset($account)) {
