Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple email recipients in single notification broken #24956

Closed
enkrs opened this issue Jul 24, 2018 · 2 comments
Closed

Multiple email recipients in single notification broken #24956

enkrs opened this issue Jul 24, 2018 · 2 comments

Comments

@enkrs
Copy link

enkrs commented Jul 24, 2018

  • Laravel Version: 5.6.28

Description:

Commit e41bee9 introduces a way to specify recipient name for email. But the functionality breaks existing possible delivery to multiple users.

Existing functionality was that routeNotificationFor('mail' returns either a string with email "aa@example.com" or array [0=>"aa@example.com", 1=>"bb@example.com"]. The new functionality adds ["Aa"=>"aa@example.com","Bb"=>"bb@example.com"] way to specify recipient names.

But because using collect($recipients)->mapWithKeys, the values without keys get overwritten:
[0=>"aa@example.com", 1=>"bb@example.com"] becomes [0=>"bb@example.com"] (because of the way the mapped function works) and notification does not reach all recipients.

This is a bug, and I think some sort of workaround can still fix this.

maybe:

-            return [(is_string($recipient) ? $recipient : $recipient->email)];
+            return [$email => (is_string($recipient) ? $recipient : $recipient->email)];

(confusing variable names)

@enkrs
Copy link
Author

enkrs commented Jul 24, 2018

Correction, The new functionality adds ["aa@example.com"=>"Aa", "bb@example.com"=>"Bb"] way to specify recipient names. I will test out if my proposed solution passes tests.

PaegleK pushed a commit to PaegleK/framework that referenced this issue Jul 24, 2018
PR laravel#24606 unfortunately broke on-demand notifications addressed to multiple recipients.
This fixes Issue  laravel#24729 and laravel#24956
taylorotwell pushed a commit that referenced this issue Jul 26, 2018
* Fix multiple notification recipients

PR #24606 unfortunately broke on-demand notifications addressed to multiple recipients.
This fixes Issue  #24729 and #24956

* Added test for multiple mail recipients.

* Remove unnecessary spaces.
@enkrs
Copy link
Author

enkrs commented Jul 27, 2018

Fixed in 5.6.29

@enkrs enkrs closed this as completed Jul 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant