Problem/Motivation

It is not possible at the moment to send an email to multiple recipients without assigning multiple actions to a trigger.

Steps to reproduce

1. Install the Drupal Instance
2. Enable the Actions module
3. Go to configuration->Actions
4. Than Choose the Send email option in the dropdown option and Click the create button
5. Add the Title and Enter Multiple recipients e-mail address with comma separated. You can able to reproduce the issue.

Proposed resolution

Allows a comma separated list of email addresses to be used (rather than forcing a single value) by:
- splitting the string in "Recipient email address" field on boundaries formed by comma (,) or comma + space (, )
- iterating over recipients with foreach ($recipients as $recipient) or similar.

Remaining tasks

- Code review

Before/after behavior

Before:

Existing behavior

After:

Behavior after patch

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#71 284036-afterpatch.png127.49 KBgaurav-mathur
#71 284036-beforepatch.png111.95 KBgaurav-mathur
#69 actions - after_patch.png228.61 KBDeepaliJ
#69 actions - before_patch.png222.89 KBDeepaliJ
#68 284036-68.patch3.24 KBrishabh064
#67 284036-67.patch3.23 KBpooja saraah
#66 284036-66.patch3.24 KBSivaji_Ganesh_Jojodae
#65 interdiff-284036-64_65.txt861 bytesAnchal_gupta
#65 284036-65.patch7.6 MBAnchal_gupta
#64 284036_64.patch3.24 KBSivaji_Ganesh_Jojodae
#62 After patch ME.png92.32 KBAamir M
#62 Before patch ME.png96.16 KBAamir M
#56 ss-after-patch.png42.02 KBvinaymahale
#56 ss-before-patch.png42.17 KBvinaymahale
#49 interdiff_41-49.txt1.5 KBashishsingh27
#49 284036-49.patch3.27 KBashishsingh27
#48 interdiff_41-46.txt1.55 KBashishsingh27
#46 verified_space_error.png39.15 KBashishsingh27
#46 284036-46.patch3.27 KBashishsingh27
#44 spacing_error.png72.31 KBlucassc
#42 After-Patch-284036.png151.68 KBManibharathi E R
#42 Before-Patch-284036.png169.21 KBManibharathi E R
#41 32-41-interdiff.txt1.94 KBeleonel
#41 284036-41.patch3.18 KBeleonel
#41 284036-41-test-only.patch1.76 KBeleonel
#36 after--patch-save-action.png24.58 KBvikashsoni
#36 after--patch-action.png40.78 KBvikashsoni
#36 before--patch-action.png44.98 KBvikashsoni
#33 Screen Shot 2020-07-13 at 6.22.51 PM.png327.97 KBtanubansal
#33 Screen Shot 2020-07-13 at 6.25.04 PM.png315.04 KBtanubansal
#33 Screen Shot 2020-07-13 at 6.23.48 PM.png325.16 KBtanubansal
#32 core-actions-allow-multiple-recipients-284036-32.patch1.42 KBNathaniel
#9 D8-284036-9.patch5.83 KBcrifi
#9 D7-284036-9.patch4.24 KBcrifi
#7 284036-7.patch5.41 KBcrifi
#3 284036-3.patch4.69 KBcrifi
actions_multiple_email_recipients.patch2.58 KBmatt@antinomia

Issue fork drupal-284036

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

stowell48’s picture

Is there a patch out that will allow this for drupal 6.x?

wintervanilla’s picture

Priority: Minor » Normal
Status: Needs review » Active

I'd also love to see this functionality! Has anyone worked out a solution for this in 6.x?

crifi’s picture

Project: Actions » Drupal core
Version: 5.x-2.5 » 7.x-dev
Component: Code » system.module
Status: Active » Needs review
FileSize
4.69 KB

I would also like this feature, so let's commit a new patch. The patch doesn't consider the default language of more than one user. Should we always send in the default site language for more than one user?
Or split the mail recipients and send mails separately? This can be a problem with the load...

crifi’s picture

Status: Needs review » Needs work

The last submitted patch, 284036-3.patch, failed testing.

bfroehle’s picture

+++ modules/system/system.module	21 Jan 2011 18:39:21 -0000
@@ -3158,12 +3160,12 @@ function system_send_email_action($entit
-  $recipient_account = user_load_by_mail($recipient);
+  $recipient_account = user_load_by_mail($recipients);

This seems problematic -- I think you'd have to do a foreach ($recipients as $recipient) or similar here.

Powered by Dreditor.

crifi’s picture

Status: Needs work » Needs review
FileSize
5.41 KB

Thanks bfroehle, but the problem is a false positive test, because I renamed the variable "recipient" to the plural "recipients". I don't know if this is allowed, but i have now adapt the test against my patch, so it can proof the recipients vars correctly.
But the point you suggested is still open. I don't know if it is useful to load the language for every recipient and send mails separately.

bfroehle’s picture

Status: Needs review » Needs work

Comment in #6 still stands..

Also... I think at this point it's too late to rename 'recipient' to 'recipients' in any way, as some contributed modules might be using it...

But overloading 'recipient' to allow multiple emails might be okay.

crifi’s picture

Version: 7.x-dev » 8.x-dev
FileSize
4.24 KB
5.83 KB

Okay so under the presumption that users would not use the action function as mass mail service (performance problem), I patch this with a foreach for individual user language support.

And there are two versions now:
D8) For code consistence and coding standard we rename the var "recipient" into the plural in the next major release of Drupal.
D7) For compatibility to contributed modules we hold the var name "recipient" in all other versions.

crifi’s picture

Status: Needs work » Needs review

Set it to need review for automatic testing...

crifi’s picture

Version: 8.x-dev » 7.x-dev

D8 branches seems to be ignored for testing, so let's take it back to D7 first. :(

benanderson’s picture

subscribe

crifi’s picture

Version: 7.x-dev » 8.x-dev

Moving this to D8 list...

mxh’s picture

The send-email action should be fixed soon in future versions of both D7 and D8. Multiple recipients in one field is a typical use-case. I don't know why there is so little discussion about it.

Therefore, also tokens which supply multiple values should be supported in the recipients field.

In D6 there was the 'send *tokenized* email' action available delivered by Token Actions module, which did the job right (-> allowing multiple recipients). Unfortunately this module has been removed since the actions are supported "by core".

So the core action should support it too. Except of mass mailers, which are too big for the need here, i couldn't find an alternative action out-of-the box.

If there is no interest in fixing this problem, please tell me, so i will develop a module for a send-email action allowing multiple recipients the next time.

justindodge’s picture

+1 Hoping to see this functionality get committed..

Itmman’s picture

Wondering how to send and e-mail notification to site editors (3-4 people)

mxh’s picture

#16: if you have at least only 3 - 4 editors to notify, and they're always the same people, you could just configure 4 single system send email actions for every editor. In the recipient field, you'll just type in the static and valid email value.
Then you would have 4 actions like "inform mr. xy about this content".

If this is more complicated, like there are dynamic editor groups, or every node has several defined email adresses to notify, then timtowtdi. Let me give you a summary.

Warning: These solutions should only be interesting if there is no "mass-mail" sending.

1. quick, effective, but NOT recommended:

  1. Open modules/system/system.module, line 3157. There is the system_send_email_action_validate() function. Uncomment the whole content of the function (but do not uncomment the validation function itself.).
  2. Clear cache.

You are now able to configure system send email actions, where the recipient field is not being validated.

Good: Multiple recipients, also can be defined by any token. If token has no ":mail" suffix, you should use email fields so a validation exists on node editing *
Bad: No validation; modified core -> self-explanatory.

2. quick, partially effective (sill not any token usable), better than 1.:

  1. Apply patch from #9
  2. Clear cache.

Now it's possible to configure system send email actions with multiple recipients defined by valid static email value or tokens with suffix ":mail".
Good: Validation still exists.
Bad: Modified core; unfortunately no other tokens can be used for the recipient field value but with ":mail" suffix.

3. not so quick, but effective, for me the best solution at this time:

Create an own module, see Creating Drupal 7.x Modules Guide if you're not familiar with writing modules.

This module will register an alternative send email action without validation. Below this post you'll see an example snippet how you could implement this. Unfortunately, I don't have the time to contribute a whole project, also I don't want to produce 'almost duplicate' modules, since this one here is very familiar with the system send email action. But I hope the code below also helps you out.

Good: No core modification; you can use any token.
Bad: No validation. You must be sure that the recipient field will get valid email adresses. Therefore, email fields can help you out * .

This is a possibility to implement an alternative send email action:

<?php
/**
* @file
* Alternative system based send-email action allowing multiple recipients.
*/

/**
* Implements hook_help.
*
*/
function email_send_help($path, $arg) {
  switch ($path) {
    case "admin/help#email_send":
      return '<p><strong>Warning:</strong> Only administrators should use this module. Currently, there is no real email validation on the recipient field. Recommended: Use \'email field\' module when using tokens in recipient field.</p><p>By enabling this module, you will get a new action: Send e-mail (without validation). This alternative sendmail-action allows multiple recipients.<br><strong>Example usage</strong> in recipient field: [node:YOUREMAILFIELD:raw] brings output \'person@example1.com, person2@example2.com\' (when using multiple values)<br>[node:author:mail], [node:YOUREMAILFIELD:raw] is also possible</p>';
      break;
  }
}

/**
 * Implements hook_action_info().
 */
function email_send_action_info() {
  return array(
    'email_send_without_validation_action' => array(
      'type' => 'system',
      'label' => t('Send e-mail (without validation)'),
      'configurable' => TRUE,
      'triggers' => array('any'),
    ),
  );
}

/**
 * Return a form definition so the Send email action can be configured.
 *
 */
function email_send_without_validation_action_form($context) {
  // Set default values for form.
  if (!isset($context['recipient'])) {
    $context['recipient'] = '';
  }
  if (!isset($context['subject'])) {
    $context['subject'] = '';
  }
  if (!isset($context['message'])) {
    $context['message'] = '';
  }

  $form['recipient'] = array(
    '#type' => 'textfield',
    '#title' => t('Recipient'),
    '#default_value' => $context['recipient'],
    '#maxlength' => '254',
    '#description' => t('The email address to which the message should be sent. Possible entries: Valid static email value, Raw email field data like [node:email_field] , mail fields like [node:author:mail] or [comment:author:mail].'),
  );
  $form['subject'] = array(
    '#type' => 'textfield',
    '#title' => t('Subject'),
    '#default_value' => $context['subject'],
    '#maxlength' => '254',
    '#description' => t('The subject of the message.'),
  );
  $form['message'] = array(
    '#type' => 'textarea',
    '#title' => t('Message'),
    '#default_value' => $context['message'],
    '#cols' => '80',
    '#rows' => '20',
    '#description' => t('The message that should be sent. You may include placeholders like [node:title], [user:name], and [comment:body] to represent data that will be different each time message is sent. Not all placeholders will be available in all contexts.'),
  );
  return $form;
}

/**
 * Validate email_send_without_validation_action form submissions.
 */
function email_send_without_validation_action_validate($form, $form_state) {
  /*
   * @todo: build in a validation. we need a new token for email fields like [node:emailfield:mail] visit http://drupal.org/node/1459982 regarding this issue.
   *		if this token is available, this module could be useless then.
   **/
}

/**
 * Process system_send_email_action form submissions.
 */
function email_send_without_validation_action_submit($form, $form_state) {
  $form_values = $form_state['values'];
  // 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'],
    'subject'   => $form_values['subject'],
    'message'   => $form_values['message'],
  );
  return $params;
}

/**
 * Sends an e-mail message. (Copied from system.module)
 */
function email_send_without_validation_action($entity, $context) {
  if (empty($context['node'])) {
    $context['node'] = $entity;
  }

  $recipient = token_replace($context['recipient'], $context);

  $recipient_account = user_load_by_mail($recipient);
  if ($recipient_account) {
    $language = user_preferred_language($recipient_account);
  }
  else {
    $language = language_default();
  }
  $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));
  }
}

/**
 * Implements hook_form_FORM_ID_alter().
 * Add token tree
 */
function email_send_form_system_actions_configure_alter(&$form, $form_state) {
  $action = actions_function_lookup($form['actions_action']['#value']);

  switch ($action) {
    case 'email_send_without_validation_action':
      $form['token_tree'] = array(
        '#theme' => 'token_tree',
        '#token_types' => 'all',
        '#weight' => 100,
      );
     break;
  }
}
?>

* If you want to use email fields with multiple values, you should set the correct default token format. See http://drupal.org/node/1459982 for further instructions.

naxoc’s picture

#9: D8-284036-9.patch queued for re-testing.

alansaviolobo queued 9: D7-284036-9.patch for re-testing.

The last submitted patch, 9: D7-284036-9.patch, failed testing.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

jhedstrom’s picture

Version: 8.1.x-dev » 8.2.x-dev
Issue summary: View changes
Status: Needs review » Postponed (maintainer needs more info)

This hasn't been touched in quite some time. Is it still relevant in 8.x?

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Albert Volkman’s picture

This is still happening in 8.8.2

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Nathaniel’s picture

Category: Feature request » Bug report
Status: Postponed (maintainer needs more info) » Needs review
FileSize
1.42 KB

This seems like a bug or regression at this point (or maybe this is a different issue?).

1. Install Drupal core standard, enable Actions module.
2. Click "Configure" link for Actions module.
3. Under "CREATE AN ADVANCED ACTION" select "Send email" and click create.
4. Fill out the fields. In the "Recipient email address" field enter multiple email addresses separated by a comma.
5. Click save.

The field description says: "Separate recipients with a comma." When clicking save an error message pops up and it wont save.

Error message:
Enter a valid email address or use a token email address such as [node:author:mail].

Note that it does seem to work with multiple tokens: [node:author:mail], [comment:author:mail]. Or even a combination of email addresses and tokens, but NOT with multiple email addresses.

core/lib/Drupal/Core/Action/Plugin/Action/EmailAction.php

public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
    if (!$this->emailValidator->isValid($form_state->getValue('recipient')) && strpos($form_state->getValue('recipient'), ':mail') === FALSE) {
      // We want the literal %author placeholder to be emphasized in the error message.
      $form_state->setErrorByName('recipient', t('Enter a valid email address or use a token email address such as %author.', ['%author' => '[node:author:mail]']));
    }
  }
tanubansal’s picture

Tested with the latest patch and its working fine
This can be moved to RTBC

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

vikashsoni’s picture

Tested with #32 patch working fine after patch we able to add multiple coma separated email field instead of token email value for ref sharing screenshot

quietone’s picture

Issue summary: View changes
Status: Needs review » Needs work
Issue tags: +Needs issue summary update, +Novice, +Needs tests

@vikashsoni, the previous comment added screenshots of the latest patch, there is no need to add another set which creates noise in the issue. Therefor, credit has been removed per How is credit granted for Drupal core issues.

This will need a test, adding tag.

This also needs an issue summary update, see Write an issue summary for an existing issue for guidance. It also needs steps to reproduce. A skim of the isseu and there are some in #32.

Updating the Issue summary is a suitable novice task, adding tag.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Janner’s picture

#32 worked for me, enabling me to get the send email action working as desired in the new ECA: Event - Condition - Action module.

eleonel’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
FileSize
1.76 KB
3.18 KB
1.94 KB

Test attached.

$ cd core
$ ../vendor/bin/phpunit --filter testMultipleRecipientsEmailAction tests/Drupal/KernelTests/Core/Action/EmailActionTest.php

Testing Drupal\KernelTests\Core\Action\EmailActionTest
.                                                                   1 / 1 (100%)

Time: 1.06 seconds, Memory: 4.00 MB

OK (1 test, 9 assertions)
Manibharathi E R’s picture

FileSize
169.21 KB
151.68 KB

Patch #41 applied successfully on Drupal 9.5.x.

Steps to Reproduce:
1. Install the Drupal Instance
2. Enable the Actions module
3. Go to configuration->Actions
4. Than Choose the Send email option in the dropdown option and Click the create button
5. Add the Title and Enter Multiple recipients e-mail address with comma separated. You can able to reproduce the issue.

Test Results:
After adding the patch able to add multiple email address.

lucassc’s picture

Assigned: Unassigned » lucassc
lucassc’s picture

Assigned: lucassc » Unassigned
FileSize
72.31 KB

I successfully applied patch #41 (284036-41.patch) for Drupal 9.5.x and 10.0.x using the Steps to Reproduce in #42.

The action with multiple email address has been successfully saved in both versions.

It's not a big deal but I noticed the description has spaces after commas, enter with these spaces I got an error message. (see spacing_error.png). I wonder if this might confuse new users...

ashishsingh27’s picture

Assigned: Unassigned » ashishsingh27
Status: Needs review » Needs work
ashishsingh27’s picture

Hi,

I applied the patch and was able to send to multiple email address.

But, As mentioned by @lucassc when tried to enter email with spaces got an error message.

attaching the patch to fix the spaces error.

ashishsingh27’s picture

Assigned: ashishsingh27 » Unassigned
ashishsingh27’s picture

FileSize
1.55 KB

attaching inter-diff for 41-46.

ashishsingh27’s picture

I checked the patch on #46 again and found that I made mistake with EmailActionTest.php.

Attaching the fixed patch.

also, Attaching interdiff with 41-49.

gquisini’s picture

Assigned: Unassigned » gquisini

I'll be reviewing.

gquisini’s picture

Assigned: gquisini » Unassigned
Status: Needs review » Reviewed & tested by the community

OK,
I applied the #49 patch and following #42 steps
I was able to enter multiple recipients with/without spaces after commas.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 49: 284036-49.patch, failed testing. View results

reenaraghavan’s picture

Assigned: Unassigned » reenaraghavan

I will work on this issue.

reenaraghavan’s picture

Assigned: reenaraghavan » Unassigned
gquisini’s picture

Status: Needs work » Reviewed & tested by the community

I think we can switch to RTBC, since in the latest tests, everything is working and the problem reported in #52 is with ckeditor tests.

vinaymahale’s picture

FileSize
42.17 KB
42.02 KB

Patch #49 works for me on D9.5.x-dev

Configuration before applying patch:

Before Patch

Configuration after applying patch:

After Patch

Looks good to merge!

quietone’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs work

When setting an issue to RTBC remember to check the tags for tasks that still need to be done. This one is tagged for an Issue Summary update (asked for in #37) and that still needs to be done. I have added the template to help that along. Also, patches to Drupal need a core review before commit. I see a fair bit of testing in the comment but no evidence of code review.

There are several steps, or gates, that an issue must pass before it is marked RTBC. For most issues following step 10 in the Review a patch or merge request task of the Contributor guide is sufficient. The complete list of core gates has more topics. Also, check the tags on the issue and make sure they are complete.

@vinaymahale, adding screenshots to an issue that is RTBC is not needed. Therefor, I am removing credit per How is credit granted for Drupal core issues.

lucassc’s picture

Issue summary: View changes

Added Steps to reproduce, Proposed resolution, Remaining tasks and Before/after behavior in the IS.

lucassc’s picture

Status: Needs work » Needs review
Issue tags: -Needs issue summary update +Needs review

Patch #49 needs review.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Aamir M’s picture

Assigned: Unassigned » Aamir M
Aamir M’s picture

Assigned: Aamir M » Unassigned
FileSize
96.16 KB
92.32 KB

Patch #49 was applied successfully and mentioned issue was also resolved.

Testing Steps:

1. Install the Drupal Instance
2. Enable the Actions module
3. Go to configuration->Actions
4. Than Choose the Send email option in the dropdown option and Click the Create button
5. Add the Title and Enter Multiple recipients' e-mail addresses with comma separated. You can able to reproduce the issue.
6. Observe its throwing error and Multiple recipients' e-mail addresses not saved
7. Apply the patch and follow the same steps as mentioned above
8. Now observe Multiple recipients' e-mail addresses saved successfully
9. No error is displayed

Results:
The Multiple recipients' e-mail addresses were saved successfully after applying the patch.
Looks good to me.
Can be moved to RTBC
RTBC+1

Manoj Raj.R’s picture

I applied the #49 patch and looks good for me.
Thanks

Sivaji_Ganesh_Jojodae’s picture

Patch re-rolled.

Removed the redundant calls to explode,

+    if ($recipients = explode(',', $form_state->getValue('recipient')) || $recipients = explode(', ', $form_state->getValue('recipient'))) {

and using array_filter() and array_map() instead.

$recipients = array_filter(array_map('trim', $recipients));
Anchal_gupta’s picture

I haved fixed cs error. Please review it

Sivaji_Ganesh_Jojodae’s picture

Patch #65 seems to have other changes as well.

pooja saraah’s picture

Fixed failed commands on #66

rishabh064’s picture

Added fix for #67

DeepaliJ’s picture

Patch #68 was applied successfully on 10.1.x-dev

The issue has been resolved and working fine.
The Multiple recipients' e-mail addresses were saved successfully after applying the patch.

Before Patch:
before

After Patch:
Only local images are allowed.

RTBC +1

gaurav-mathur’s picture

Assigned: Unassigned » gaurav-mathur
gaurav-mathur’s picture

Assigned: gaurav-mathur » Unassigned
FileSize
111.95 KB
127.49 KB

Successfully Applied patch #68 for Drupal 10.1.x version and working fine, Adding screenshots to refer after and before patch.

vinaymahale’s picture

Reviewed the code from patch #68
Looks good!
Setting to RTBC as per #69

vinaymahale’s picture

Status: Needs review » Reviewed & tested by the community
quietone’s picture

Status: Reviewed & tested by the community » Needs review

Changes to the patch where made back in August, #49. Since that time there has not been a review of the patch. I am setting back to needs review for a thorough review of the code. Note that this was tagged for a review in #59 and the tag is still on the issue.

I also see that the patch in #49 was tested in #56 and #62, both adding screenshots. Then rerolled and tested in #69 and #71, again with screenshots. For those who like to test issues, remember to read the comments to ensure that you are adding value to the issue.

DanielVeza’s picture

Ah, just came across this issue - There is two issues for this bug. They should be merged into one. Patches look quite similar. #3307187: Action "Send email" not validating recipient field with multiple addresses

quietone’s picture

Issue summary: View changes
Issue tags: -Needs review

In #bugsmash, Kristen Pol pointed out that this has a tag of 'Needs review' and was asking about it's relevance. In my last review I should have noticed that and removed the tag because we have the status of 'Needs review'. A tag could be added for a code review but I think it is better to add that this needs a code review to the Issue Summary. I see that was already done (didn't look up when) but there was a spelling mistake which I have fixed.

pameeela’s picture

Status: Needs review » Closed (duplicate)
Issue tags: -Novice +Bug Smash Initiative

This is definitely a duplicate of #3307187: Action "Send email" not validating recipient field with multiple addresses, the patches are almost identical! This issue is older but the other one has a more recent patch so I am closing this one and will move credit.