本文整理汇总了PHP中YiiMailMessage::setCc方法的典型用法代码示例。如果您正苦于以下问题:PHP YiiMailMessage::setCc方法的具体用法?PHP YiiMailMessage::setCc怎么用?PHP YiiMailMessage::setCc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类YiiMailMessage
的用法示例。
在下文中一共展示了YiiMailMessage::setCc方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendMail
public static function sendMail($params = array())
{
/** @var $message YiiMailMessage */
$message = new YiiMailMessage();
/*
$base_path = Yii::getPathOfAlias('application.views.mail.images');
$files = CFileHelper::findFiles($base_path);
$imgs = array();
foreach ($files as $file) {
$imgs[basename($file)] = $message->embed(Swift_Image::fromPath($file));
}
if(isset($params['params']['attachedFilePath'], $params['params']['attachedFileName'])) {
$message->attach(Swift_Attachment::fromPath($params['params']['attachedFilePath'])->setFilename($params['params']['attachedFileName']));
}
$params['params']['imgs'] = $imgs;
*/
$message->view = $params['view'];
$message->subject = $params['subject'];
$message->setTo($params['to']);
if (isset($params['cc'])) {
$message->setCc($params['cc']);
}
if (isset($params['bcc'])) {
$message->setBcc($params['bcc']);
}
$message->setBody($params['params'], 'text/html');
$message->addPart(self::getPlainTextVersion($message, $params['params']), 'text/plain');
$message->attachSigner(self::getSigner());
$message->from = Yii::app()->params['mail_sender'];
return Yii::app()->mail->send($message);
}
示例2: sendMail
public static function sendMail($data)
{
// self::_setTestEmail($data, 'quocbao1087@gmail.com');
$message = new YiiMailMessage($data['subject']);
$message->setBody($data['message'], 'text/html');
if (is_array($data['to'])) {
foreach ($data['to'] as $t) {
$message->addTo($t);
}
} else {
$message->addTo($data['to']);
}
if (isset($data['cc'])) {
$message->setCc($data['cc']);
}
$message->from = $data['from'];
$message->setFrom(array($data['from'] => Yii::app()->setting->getItem('title_all_mail')));
// test email using local mail server
if ($_SERVER['HTTP_HOST'] == 'localhost') {
Yii::app()->mail->transportType = 'smtp';
Yii::app()->mail->transportOptions = array('host' => 'localhost', 'username' => null, 'password' => null);
}
return Yii::app()->mail->send($message);
}