本文整理汇总了PHP中Nette\Mail\Message::addBcc方法的典型用法代码示例。如果您正苦于以下问题:PHP Message::addBcc方法的具体用法?PHP Message::addBcc怎么用?PHP Message::addBcc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Mail\Message
的用法示例。
在下文中一共展示了Message::addBcc方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addBcc
/**
* @param string $email
* @param string $name
*/
public function addBcc($email, $name = null)
{
try {
$this->message->addBcc($email, $name);
} catch (\Exception $e) {
throw new MailerException($e->getMessage());
}
}
示例2: generateMessage
public function generateMessage(Reciever $reciever, ContentConfig $contentConfig)
{
$message = new Message();
$message->setFrom($this->sender->getEmail(), $this->sender->getName());
$message->setBody($contentConfig->getContent($reciever));
$message->setSubject($contentConfig->getSubject());
$message->addTo($reciever->getEmail(), $reciever->getFullName());
$message->addBcc($this->sender->getEmail());
foreach ($contentConfig->getAttachments() as $attachment) {
$message->addAttachment($attachment);
}
return $message;
}
示例3: sendDokument
/**
* Funkce odesílající emaily s dokumenty lidem.
*
* Maily odesílá podle šablony v presenters/Emaily/dokument.latte
*
* @param \Nette\Database\Table\ActiveRow $dokument Dokument k rozeslání
* @param \Nette\Database\Table\Selection $lidi Lidé k obmailování
* @param string $link Link na dokument
* @return integer Počet odeslaných emailů
*/
public function sendDokument($dokument, $lidi, $link)
{
$mail = new Message();
$mail->setFrom($this->mailerFromAddress)->setSubject('Nový dokument SVJ Čiklova 647/3');
$pocet = 0;
foreach ($lidi as $clovek) {
$mail->addBcc($clovek->email, $clovek->jmeno);
$pocet++;
}
$latte = new \Latte\Engine();
$params = array('orderId' => 123, 'link' => $link, 'dokument' => $dokument);
$mail->setHtmlBody($latte->renderToString(self::templateFolder . 'dokument.latte', $params));
$mail->addAttachment($dokument->jmeno, file_get_contents(Dokument::DOKUMENTY_FOLDER . $dokument->soubor));
$this->mailer->send($mail);
return $pocet;
}
示例4: 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;
}
示例5: 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;
}
示例6: sendEmail
/**
* Here's the magic
*
* @param array $recipients
* @param null $subject
* @param array $data
* @throws EmailException
*/
private function sendEmail($recipients = array(), $subject = '', $data)
{
// recipients check
if (!is_array($recipients)) {
$recipients = array($recipients);
}
if (count($recipients) < 1) {
throw new EmailException('No subscribers provided. (possibly none in your system)');
}
// try sending e-mail
try {
$mail = new \Nette\Mail\Message();
$mail->setFrom($this->senderEmail, $this->senderName)->setSubject($subject);
foreach ($recipients as $recipient) {
$mail->addBcc($recipient);
}
// set HTML / or plaintext body
if ($this->htmlEmail == TRUE) {
$mail->setHTMLBody($this->getEmailTemplate($data));
} else {
$mail->setBody($this->getEmailTemplate($data));
}
$this->mailer->send($mail);
} catch (\Exception $e) {
throw new EmailException($e->getMessage());
}
}
示例7: addBcc
function addBcc($args)
{
$this->Message->addBcc($args);
}
示例8: newsletterFormSucceeded
public function newsletterFormSucceeded(UI\Form $form, $values)
{
if (!$values['event_id']) {
$values['event_id'] = null;
}
$this->saveFormValues($values);
$contacts = array();
if (!$values['event_id'] && $values['notTest']) {
foreach ($this->registration as $registration) {
$contacts[] = $registration->email;
}
foreach ($this->ticket as $ticket) {
$contacts[] = $ticket->email;
}
$contacts = array_unique($contacts);
} elseif ($values['notTest']) {
foreach ($this->registration->where('event_id = ?', $values['event_id']) as $registration) {
$contacts[] = $registration->email;
}
foreach ($this->ticket->where('event_id = ?', $values['event_id']) as $ticket) {
$contacts[] = $ticket->email;
}
$contacts = array_unique($contacts);
} else {
$contacts = [0 => self::EMAIL_OPERATOR];
}
$mail = new Nette\Mail\Message();
$mail->setFrom('Hudební S.O.S. <info@hudebnisos.cz>')->setSubject($values['subject'])->setHtmlBody('
<html><head><title>' . $values['subject'] . '</title></head>
<body>
<div style="background-color: rgb(197, 230, 235);color: rgb(0, 117, 117);letter-spacing: 0.3px; margin: auto auto; padding:1em 1em">
' . $values['text'] . '
<br /><br />
</div>
<hr style="border:0;border-top: 1px solid #DDD;" />
<center>
<small>
<font style="color:silver;font-family:\'Helvetica Neue\', sans-sherif">Pro odhlášení odpovězte na tento email slovy "Prosím odhlásit".</font>
</small>
</center>
</body></html>');
/** @var Nette\Http\FileUpload $attach */
foreach ($values['files'] as $attach) {
$mail->addAttachment($attach->getSanitizedName(), $attach->getContents());
}
$counter = 0;
foreach ($contacts as $contact) {
$counter++;
$mail->addBcc($contact);
}
$mailer = new Nette\Mail\SendmailMailer();
try {
$mailer->send($mail);
if (!$values['notTest']) {
$this->flashMessage("Byl odeslán testovací email.", 'success');
} else {
$this->flashMessage("Bylo odesláno {$counter} emailů.", 'success');
}
} catch (\Exception $e) {
$this->flashMessage('Při odesílání došlo k chybě. :: ' . $e->getMessage());
}
$this->redirect('this');
}