Problem/Motivation
The "Send email" action has a recipient field which allows multiple email addresses to be entered. The help states "Separate recipients with a comma.".
The validation performed on the field doesn't take this into account.
Steps to reproduce
Create a new action "Send email", fill in all the fields. In the recipient field, add multiple valid email addresses separated by a comma, click "Save".
Proposed resolution
Split the field value on a comma and loop through the results, validating each one.
This shouldn't break anything as all existing values in the field would still validate.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comments
Comment #2
imclean commentedComment #3
abhijith s commentedApplied patch #2 on 9.4.x.Multiple email addresses are accepted in the recipient field after applying this patch.
Before patch:

After patch:

Comment #4
Bushra Shaikh commentedVerified and tested patch #2 on the drupal 9.4.x-dev version and the patch applied successfully and looks good to me.
Testing Steps:
Testing Results:
After applying the patch multiple email addresses are accepted in the recipient field
We can move this ticket to RTBC.
Comment #7
smustgrave commentedD10 version needed
At this time we would need a D10.1.x patch or MR for this issue.
Comment #8
imclean commentedComment #9
imclean commentedIt looks like
$this->t()is being used here now.Comment #10
gaurav-mathur commentedHi i will review this patch.
Comment #11
gaurav-mathur commentedApplied patch #9 for Drupal 10.1.x version and working fine. adding screenshot for the reference.
Comment #12
himanshu_jhaloya commented#9 patch applied cleanly on 10.1.x-dev , looks good adding screenshot
Comment #13
quietone commented@gaurav-mathur and @himanshu_jhaloya, thank you for your interest in this issue. However, uploading screenshots of a patch applying is never helpful. The testbot tells us if the patch applies. You can find instructions for Review a patch or merge request task in the Contributor guide. The contributor guide also has details for other ways to help.
Reading the issue I see that this has not passed the core gates.
This issue is tagged for tests and that still needs to be done. There is also no code review.
Setting back to NW.
Comment #14
danielvezaDone a first review of the patch, it looks good. I made some minimal changes and added a test.
There is a bit of code duplication in the test with creating the plugin and reading the logs, but it hasn't broken the rule of three so I've left it rather than creating private functions.
Comment #25
pameeela commentedClosed #284036: Allow multiple recipients in email actions as a duplicate, moving credit.
Comment #26
smustgrave commentedThis issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request as a guide.
Confirmed the issue on Drupal 10.
Was not able to add multiple emails
Applied the patch and I can
Comment #27
alexpottBelieve it or not but
"te,st"@example.comis a valid email address :(I think we should do a more complicated fix here. I think we need to change it so textfield is a textarea and we enter them 1 one line. And then in the form submit we smoosh them together with a comma.
Comment #28
himanshu_jhaloya commentedComment #29
danielvezaGood catch @alexpott. Lets try this one. Done the suggestion in #27
Comment #30
danielvezaOops! Patch didn't upload
Comment #31
alexpottPHP_EOL vs \r\n - which one should we use - I think we should look at the paths in block config and do the same.
Also I think we don't need to introduce $recipients variable in EmailAction::execute() - just using a single $recipient variable is fine - even if there are multiple recipients
Comment #32
danielvezaAdded a patch to address point 1 in #31. Moved to use the same regex that the request path block visibility field uses.
> Also I think we don't need to introduce $recipients variable in EmailAction::execute() - just using a single $recipient variable is fine - even if there are multiple recipients
I didn't address this. The seperate variable is introduced, otherwise the code looks messy IMO
Happy to be overridden on this point if people disagree
Comment #33
smustgrave commentedComment #34
Ajeet Tiwari commenteddid the required changes.
Comment #35
imclean commented@Ajeet Tiwari,
What changes? You've changed it back from a textarea to a textfield and deleted the test.
Comment #36
Ajeet Tiwari commentedSorry, i missed that change which i made actually while creating the patch. i will update it in the next patch.
Comment #37
smustgrave commentedHiding patch.
Comment #38
danielveza@smustgrave I might be having a case of the monday mornings, but why does this need a reroll?
Comment #39
smustgrave commentedCould of sworn when I tested #32 was failing to apply. Clearly not the case though
Comment #40
smustgrave commentedWait it doesn’t. Just retested
Comment #41
danielvezaAh yes you're correct. When I checked this morning tests were still green, other commits since the last test run must have stopped this applying. Thanks for confirming, restoring the needs reroll tag.
Comment #42
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #43
tanuj. commentedAs patch #32 doesn't apply to D10 anymore adding a reroll for it.
Comment #45
tanuj. commentedComment #46
smustgrave commentedThanks for the reroll!
Am able to add multiple recipients now.
Comment #47
larowlanCan we use the test mail collector and assert mail trait instead of relying on watchdog entries?
Also can we get red/green patches for the new approach.
Thanks
Comment #49
quietone commentedChanging component.
Action module is approved for removal. See #3266458: [Policy] Deprecate Action (UI) module in D10 and move to contrib in D11
Comment #50
asad_ahmed commentedI have modified the code to use test mail collector and assert mail trait instead of watchdogs entries. Can you please review if it works? Thanks