Index: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.1003 diff -u -p -r1.1003 system.module --- modules/system/system.module 4 Jan 2011 00:56:23 -0000 1.1003 +++ modules/system/system.module 22 Jan 2011 13:25:40 -0000 @@ -3073,8 +3073,8 @@ function system_action_info() { */ function system_send_email_action_form($context) { // Set default values for form. - if (!isset($context['recipient'])) { - $context['recipient'] = ''; + if (!isset($context['recipients'])) { + $context['recipients'] = ''; } if (!isset($context['subject'])) { $context['subject'] = ''; @@ -3083,12 +3083,12 @@ function system_send_email_action_form($ $context['message'] = ''; } - $form['recipient'] = array( + $form['recipients'] = array( '#type' => 'textfield', - '#title' => t('Recipient'), - '#default_value' => $context['recipient'], + '#title' => t('Recipients'), + '#default_value' => $context['recipients'], '#maxlength' => '254', - '#description' => t('The email address to which the message should be sent OR enter [node:author:mail], [comment:author:mail], etc. if you would like to send an e-mail to the author of the original post.'), + '#description' => t('The email address(es) to which the message should be sent OR enter [node:author:mail], [comment:author:mail], etc., if you would like to send an e-mail to the author of the original post. Use commas to separate multiple recipients.'), ); $form['subject'] = array( '#type' => 'textfield', @@ -3114,10 +3114,12 @@ 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']) && strpos($form_values['recipient'], ':mail') === FALSE) { - // We want the literal %author placeholder to be emphasized in the error message. - form_set_error('recipient', t('Enter a valid email address or use a token e-mail address such as %author.', array('%author' => '[node:author:mail]'))); - } + foreach (explode(',', $form_values['recipients']) as $recipient) { + if (!valid_email_address(trim($recipient)) && strpos(trim($recipient), ':mail') === FALSE) { + // We want the literal %author placeholder to be emphasized in the error message. + form_set_error('recipients', t('Enter valid comma separated email address(es) or use a token e-mail address such as %author.', array('%author' => '[node:author:mail]'))); + } + } } /** @@ -3128,7 +3130,7 @@ function system_send_email_action_submit // Process the HTML form to store configuration. The keyed array that // we return will be serialized to the database. $params = array( - 'recipient' => $form_values['recipient'], + 'recipients' => $form_values['recipients'], 'subject' => $form_values['subject'], 'message' => $form_values['message'], ); @@ -3143,7 +3145,7 @@ function system_send_email_action_submit * provided. * @param array $context * Array with the following elements: - * - 'recipient': E-mail message recipient. This will be passed through + * - 'recipients': E-mail message recipients. This will be passed through * token_replace(). * - 'subject': The subject of the message. This will be passed through * token_replace(). @@ -3158,25 +3160,27 @@ function system_send_email_action($entit $context['node'] = $entity; } - $recipient = token_replace($context['recipient'], $context); - - // If the recipient is a registered user with a language preference, use - // the recipient's preferred language. Otherwise, use the system default - // language. - $recipient_account = user_load_by_mail($recipient); - if ($recipient_account) { - $language = user_preferred_language($recipient_account); - } - else { - $language = language_default(); - } + $recipients = token_replace($context['recipients'], $context); $params = array('context' => $context); - - if (drupal_mail('system', 'action_send_email', $recipient, $language, $params)) { - watchdog('action', 'Sent email to %recipient', array('%recipient' => $recipient)); - } - else { - watchdog('error', 'Unable to send email to %recipient', array('%recipient' => $recipient)); + + foreach (explode(',', $recipients) as $recipient) { + $recipient = trim($recipient); + // If the recipient is a registered user with a language preference, use + // the recipient's preferred language. Otherwise, use the system default + // language + $recipient_account = user_load_by_mail($recipient); + if ($recipient_account) { + $language = user_preferred_language($recipient_account); + } + else { + $language = language_default(); + } + if (drupal_mail('system', 'action_send_email', $recipient, $language, $params)) { + watchdog('action', 'Sent email to %recipient', array('%recipient' => $recipient)); + } + else { + watchdog('error', 'Unable to send email to %recipient', array('%recipient' => $recipient)); + } } } Index: modules/trigger/trigger.test =================================================================== RCS file: /cvs/drupal/drupal/modules/trigger/trigger.test,v retrieving revision 1.37 diff -u -p -r1.37 trigger.test --- modules/trigger/trigger.test 5 Oct 2010 06:17:29 -0000 1.37 +++ modules/trigger/trigger.test 22 Jan 2011 13:25:41 -0000 @@ -358,7 +358,7 @@ class TriggerActionTestCase extends Trig $action_edit = array( // 'actions_label' => $trigger . "_system_send_message_action_" . $this->randomName(16), 'actions_label' => $trigger . "_system_send_email_action", - 'recipient' => '[user:mail]', + 'recipients' => '[user:mail]', 'subject' => $message, 'message' => $message, );