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


PHP Message::addCc方法代码示例

本文整理汇总了PHP中Nette\Mail\Message::addCc方法的典型用法代码示例。如果您正苦于以下问题:PHP Message::addCc方法的具体用法?PHP Message::addCc怎么用?PHP Message::addCc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Nette\Mail\Message的用法示例。


在下文中一共展示了Message::addCc方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addCc

 /**
  * @param string $email
  * @param string $name
  */
 public function addCc($email, $name = null)
 {
     try {
         $this->message->addCc($email, $name);
     } catch (\Exception $e) {
         throw new MailerException($e->getMessage());
     }
 }
开发者ID:rukzuk,项目名称:rukzuk,代码行数:12,代码来源:Mailer.php

示例2: send

 /**
  * @param $to array|string
  * @param $params array
  * @param $template string
  * @return bool|string
  * @throws \Exception
  */
 public function send($to, $params, $template)
 {
     $latte = new \Latte\Engine();
     $mail = new Message();
     $mail->setFrom($this->fromEmail)->setHtmlBody($latte->renderToString($this->templateDir . '/' . $template, $params));
     if (!empty($this->archiveEmail)) {
         $mail->addBcc($this->archiveEmail);
     }
     if (is_string($to)) {
         $mail->addTo($to);
     } elseif (is_array($to) && count($to) > 0) {
         $mail->addTo($to[0]);
         for ($i = 1; $i < count($to); $i++) {
             $mail->addCc($to[$i]);
         }
     } else {
         return "Bad 'to' parameter";
     }
     $this->mailer->send($mail);
     return true;
 }
开发者ID:gritbox,项目名称:gritbox,代码行数:28,代码来源:EmailService.php

示例3: toMessage

 /**
  * @param array $templateParameters
  * @return Nette\Mail\Message
  */
 public function toMessage($templateParameters = [])
 {
     $latte = $this->latteFactory instanceof Nette\Bridges\ApplicationLatte\ILatteFactory ? $this->latteFactory->create() : new Latte\Engine();
     $latte->setLoader(new Latte\Loaders\StringLoader());
     $htmlBody = $latte->renderToString($this->template, $templateParameters);
     $mail = new Nette\Mail\Message();
     $mail->setFrom($this->from);
     $mail->setSubject($this->subject);
     $mail->setHtmlBody($htmlBody);
     if ($this->cc !== NULL) {
         foreach ($this->cc as $cc) {
             $mail->addCc($cc);
         }
     }
     if ($this->bcc !== NULL) {
         foreach ($this->bcc as $bcc) {
             $mail->addBcc($bcc);
         }
     }
     return $mail;
 }
开发者ID:zaxxx,项目名称:zaxcms,代码行数:25,代码来源:Entity.php

示例4: defaultMailer

 /**
  * Default mailer.
  *
  * @param $message
  * @param $email
  * @param  string|\Exception|\Throwable
  *
  * @internal
  */
 public function defaultMailer($message, $email, $exceptionFile = NULL, $priority = NULL)
 {
     if (!is_null($this->host)) {
         $host = $this->host;
     } else {
         $host = preg_replace('#[^\\w.-]+#', '', isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : php_uname('n'));
     }
     try {
         $emailSendJson = Nette\Utils\Json::decode(file_get_contents($this->directory . '/email-sent'), Nette\Utils\Json::FORCE_ARRAY);
     } catch (Nette\Utils\JsonException $e) {
         $emailSendJson = [];
     }
     $emailSendJson[$exceptionFile] = TRUE;
     @file_put_contents($this->directory . '/email-sent', Nette\Utils\Json::encode($emailSendJson));
     $mail = new Nette\Mail\Message();
     $mail->setFrom($this->fromEmail ?: (Nette\Utils\Validators::isEmail("noreply@{$host}") ? "noreply@{$host}" : "noreply@example.tld"))->addTo(is_array($email) ? $email[0] : $email)->setSubject("PHP: An error (" . $this->getTitle($message, $priority) . ") occurred on the server {$host}")->setHtmlBody($this->formatMessage($message) . "\n\nsource: " . Tracy\Helpers::getSource() . (is_null($exceptionFile) ? '' : "\n\nexception link: " . Nette\Utils\Strings::replace($exceptionFile, ['~^(.*)exception--~' => 'http://' . $host . $this->path . 'exception--'])));
     if (is_array($email)) {
         foreach ($email as $k => $v) {
             if ($k == 0) {
                 continue;
             }
             $mail->addCc($v);
         }
     }
     $this->mailerClass->send($mail);
 }
开发者ID:trejjam,项目名称:utils,代码行数:35,代码来源:Logger.php

示例5: addCc

 function addCc($args)
 {
     $this->Message->addCc($args);
 }
开发者ID:profectsro,项目名称:mailgun-mailer,代码行数:4,代码来源:MailgunMailer.php


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