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

For \craft\mail\Message setTo($to) doesn't work if $to is User[] #4048

Closed
bighoho123 opened this issue Mar 26, 2019 · 1 comment
Closed

For \craft\mail\Message setTo($to) doesn't work if $to is User[] #4048

bighoho123 opened this issue Mar 26, 2019 · 1 comment

Comments

@bighoho123
Copy link

Description

When calling setTo($to), if $to is of User[], it will throw "Array to string conversion" error

Steps to reproduce

$message = new \craft\mail\Message();
$to = User::findAll();
$message->setTo($to);
$message->setSubject("Test");
$message->setHtmlBody("Hello World");

Additional info

  • Craft version: Craft Pro 3.0.26.1
  • PHP version: 7.2.5
  • Database driver & version:
  • Plugins & versions:

I think the reason being the Swiftmailer will expect $to to be ['[email protected]'=>'Person 1', '[email protected]'=>'Person 2'] instead of [['[email protected]'=>'Person 1'],[ '[email protected]'=>'Person 2']]

bighoho123 added a commit to simple-integrated-marketing/cms that referenced this issue Mar 26, 2019
Fix an issue preventing passing User[] as $emails. This is related to issue craftcms#4048
@brandonkelly
Copy link
Member

Thanks for pointing that out, it’s been fixed for the next release.

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

2 participants