当前位置: 首页>>代码示例>>PHP>>正文


PHP YiiMailMessage::setCc方法代码示例

本文整理汇总了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);
 }
开发者ID:bartaakos,项目名称:yii-shard-poc,代码行数:31,代码来源:Mailer.php

示例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);
 }
开发者ID:jasonhai,项目名称:onehome,代码行数:24,代码来源:EmailHelper.php


注:本文中的YiiMailMessage::setCc方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。