本文整理汇总了PHP中YiiMailMessage::addPart方法的典型用法代码示例。如果您正苦于以下问题:PHP YiiMailMessage::addPart方法的具体用法?PHP YiiMailMessage::addPart怎么用?PHP YiiMailMessage::addPart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类YiiMailMessage
的用法示例。
在下文中一共展示了YiiMailMessage::addPart方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}