tharanga-dinesh
tharanga-dinesh

Reputation: 567

How to send mail to multiple recipients in Yii2 mailer

This code is working for a single recipient but not for multiple recipients.How should I add multiple recipient into send() function in here.

//find price
$price = MDealPrice::model()->find("id=:id", array(':id' => $id));

// find deal
$deal = MDeal::model()->find("id=:id", array(':id' => $price->dealId));

//send email
app()->mailer->send($sendEmailAdd, 'orderAuthorizeEmail', array('deal' => $deal));

I tried like this also, But not worked.

//send email
app()->mailer->send(array('[email protected]','[email protected]'), 'orderAuthorizeEmail', array('deal' => $deal));

Thanks in advance!

Upvotes: 0

Views: 1063

Answers (1)

Ashok Chandrapal
Ashok Chandrapal

Reputation: 1020

Please try with below solution it will work

 app()->mailer->send('[email protected],[email protected]', 'orderAuthorizeEmail', array('deal' => $deal));

just add your email ids comma separated string in send function instead to pass array of email ids.

Upvotes: 1

Related Questions