Emails to multiple users from beans - dynamically

Okay, so I have a workflow, but we have a “reports to” for staff / supervisors. I’ve pulled the email addresses, but workflow won’t let me select a field on the record to use for sending to email - so I’m going on beans instead.

I have a working option that sends an email to one person, also have tested using the $email->cc_addrs and that works, but it sends them as separate emails. Sure it’s a simple get, but how do I have multiple addresses in the “to” field so it’s a group email?

Have you tried concatenating them with commas?

Have tried a few different ways, and none seem to be working as I’d expect.

The one path that DOES work is

$email->to_addrs_arr[] = Array('email' => 'EmailAddressHere, 'display' => 'NameHere')

But even adding to this array doesn’t seem to work. I have had success using the above with just one email address/displayname and then using:

$email->cc_addrs = 'EmailAddress'

But this sends as two separate emails and I’m wanting all users in my list on the one email.

And got it!

    $email->to_addrs_arr[] = Array('email' => 'email1.com', 'display' => 'displayname1');
    $email->to_addrs_arr[] = Array('email' => 'email2.com', 'display' => 'displayname2');
1 Like