本文整理汇总了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());
}
}
示例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;
}
示例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;
}
示例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);
}
示例5: addCc
function addCc($args)
{
$this->Message->addCc($args);
}