swiftmailer - How to send mail to multiple recipients in Yii2 mailer OR how to add setCc in yii2 mailer -


how send mail multiple recipients in yii2 mailer?

this code multiple recipient not working.

$value = yii::$app->mailer->compose()             ->setfrom([$this->email => $this->name])             ->setto(array($model->email_1,$model->email_2))             ->setsubject($model->status)             ->sethtmlbody($model->description)             ->send(); 

how add setcc in yii2 mailer?

this code adding setcc not working.

$value = yii::$app->mailer->compose()             ->setfrom([$this->email => $this->name])             ->setto($model->email_1)             ->setcc($model->email_2)             ->setsubject($model->status)             ->sethtmlbody($model->description)             ->send(); 

i tried following code, , it's working. things strange in code seems in setfrom array.

        yii::$app->mailer->compose()             ->setfrom('addrs1@gmail.com')             ->setto(array('addrs1@gmail.com', 'addrs2@hotmail.com'))             ->setcc(array('addrs3@gmail.com'))             ->setsubject('sending email')             ->settextbody('this plain text content')             ->sethtmlbody('please go  <a href="http://google.com/">google</a>')             ->send();     

in swift mailer code there following comments :

 * set address of message.  *  * permissible multiple addresses set using array.  *  * if multiple addresses used, should set sender address ,  * according rfc 2822, must set sender address. 

hope helps.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -