--- actions.module.orig 2008-07-17 11:27:23.000000000 -0700 +++ actions.module 2008-07-17 11:27:45.000000000 -0700 @@ -1076,7 +1076,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', @@ -1099,14 +1099,15 @@ function system_send_email_action_form($ /** * Validate system_send_email_action form submissions. */ -function system_send_email_action_validate($form_id, $form_values) { +function narrative_actions_send_email_action_validate($form_id, $form_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'))); + } } } - /** * Process system_send_email_action form submissions. */ @@ -1147,7 +1148,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', t("Cannot use '%author' token in this context.")); return; @@ -1170,9 +1171,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)) {