我想一次向多个收件人发送电子邮件而不添加cc
,并且仅to
使用YiimailMessege
扩展名。{I}有可能感谢任何建议。我尝试添加cc
它有效,但我不想添加cc
。我的代码看起来像这样
$message = new YiiMailMessage;
$message->view =$model->viewName;
$message->subject = $model->subject;
$params = array('myMail'=>$model->object1);
$message->setBody($params,'text/html');
$message->addTo($model->to);
$message->AddCC($model->from);
$message->from = $model->from;
$message->cc=array($model->senderEmail,$model->additionalEmail);
$message->Replyto = $model->from;
Yii::app()->mail->send($message);
以及to
使用YiimailMessege
扩展程序
答案 0 :(得分:1)
myArray
你试过这个案子吗
答案 1 :(得分:1)
$message = new YiiMailMessage;
$message->subject = $model->subject;
$message->view =$model->viewName;
$message->from = $model->from;
$message->setBody($params,'text/html');
$params = array('myMail'=>$model->object1);
foreach($emails as $email) {
$message->addTo($model->to);
Yii::app()->mail->send($message);
}
答案 2 :(得分:1)
受保护的函数_sendOrderDetailMail($ orderId) { $ model = $ this-> loadModel($ orderId);
$ message = new YiiMailMessage;
$ message-> view ='orderdetail';
$ message-> setBody(array('orderId'=> $ orderId,'model'=> $ model),'text / html');
$ message-> subject ='新订单已放置 - '。$ orderId;
$ MESSAGE-> AddTo就(Yii的::应用程序() - > PARAMS [ 'ADMINEMAIL']);
// emails to keep in cc
$emails = array('abc@example.com','abc1@example.com');
foreach($emails as $value){
$message->addCC(trim($value));
}
的Yii ::应用程序() - > MAIL->置于($消息); }
通过电子邮件发送