CAKEPHP:以简单的方式向两个用户发送电子邮件

Need Help!

Using CakePHP, I need to send the same email to two users, I referred this thing in forum, they all suggesting to declare a array of emails, via for loop could achieve it. But I want to make it simple that, don't wanna go for loop, how to add a one more email account over there. For (e.g. abc@account.com) need to send the same email

What I am doing to send an email for one user is......(Below Codes)

$emailadmin->template('learn_payment', 'default')
    ->to([$this->request->session()->read('Auth.User.email') => Configure::read('app_title')])
    ->from([Configure::read('support_email') => Configure::read('app_title')])
    ->subject(sprintf('You have subscribed a learning on %s', Configure::read('app_title')))
    ->emailFormat('both')
    ->send(); 

Thanks in Advance!

you can use two ways:

$mails = array();
foreach($users as $user)
{
    $mails[] = 'email1@email1.com';
    $mails[] = 'email2@email2.com';
}

$emailadmin->template('learn_payment', 'default')
      ->to($mails)
      ->from([Configure::read('support_email') => Configure::read('app_title')])
      ->subject(sprintf('You have subscribed a learning on %s', Configure::read('app_title')))
      ->emailFormat('both')
      ->send(); 

Or this way:

$emailadmin = new CakeEmail();

foreach($users as $user) {
    $emailadmin->addTo($user['User']['email']);
}

$emailadmin->template('learn_payment', 'default')
          ->from([Configure::read('support_email') => Configure::read('app_title')])
          ->subject(sprintf('You have subscribed a learning on %s', Configure::read('app_title')))
          ->emailFormat('both')
          ->send();