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


PHP Message::setHtmlBody方法代码示例

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


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

示例1: send

 /**
  * Send message
  */
 public function send()
 {
     if ($this->template instanceof ITemplate) {
         $this->message->setHtmlBody((string) $this->template);
     }
     $this->mailer->send($this->message);
 }
开发者ID:jedenweb,项目名称:mail,代码行数:10,代码来源:Message.php

示例2: createMessage

 /**
  * Vytvoří novou zprávu jakožto objekt \Nette\Mail\Message.
  * @see \Nette\Mail\Message
  * @param string|array $to Příjemce zprávy. Víc příjemců může být předáno jako pole.
  * @param string $subject Předmět zprávy.
  * @param string $message Předmět zprávy, nastavuje se přes setHtmlBody, tudíž lze předat výstup šablony.
  */
 public function createMessage($to, $subject, $message)
 {
     $this->message = new \Nette\Mail\Message();
     $this->message->setFrom($this->from);
     if (is_array($to)) {
         foreach ($to as $recipient) {
             $this->message->addTo($recipient);
         }
     } else {
         $this->message->addTo($to);
     }
     $this->message->setSubject($subject);
     $this->message->setHtmlBody($message);
 }
开发者ID:JZechy,项目名称:ZBox,代码行数:21,代码来源:Mailer.php

示例3: send

 /**
  * @param string $user
  * @param string $name
  * @param string $type
  * @param string $action
  * @param mixed[] $templateArgs
  */
 public function send($user, $name, $type, $action, array $templateArgs = array())
 {
     $presenter = $this->createPresenter();
     $request = $this->getRequest($type, $action);
     $response = $presenter->run($request);
     $presenter->template->user = $user;
     $presenter->template->name = $name;
     foreach ($templateArgs as $key => $val) {
         $presenter->template->{$key} = $val;
     }
     if (!$response instanceof TextResponse) {
         throw new InvalidArgumentException(sprintf('Type \'%s\' does not exist.', $type));
     }
     try {
         $data = (string) $response->getSource();
     } catch (\Nette\Application\BadRequestException $e) {
         if (Strings::startsWith($e->getMessage(), 'Page not found. Missing template')) {
             throw new InvalidArgumentException(sprintf('Type \'%s\' does not exist.', $type));
         }
     }
     $message = new Message();
     $message->setHtmlBody($data);
     $message->setSubject(ucfirst($action));
     $message->setFrom($this->senderEmail, $this->senderName ?: null);
     $message->addTo($user, $name);
     $this->mailer->send($message);
 }
开发者ID:venne,项目名称:venne,代码行数:34,代码来源:EmailManager.php

示例4: setHtmlBody

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

示例5: sendRegistrace

 /**
  * Funkce odesílající email s heslem po registraci.
  * 
  * Maily odesílá podle šablony v presenters/Emaily/novyucet.latte
  * 
  * @param string $jmeno Jméno člověka
  * @param string $heslo Heslo
  * @param string $email Email
  * @return integer Počet odeslaných mailů
  */
 public function sendRegistrace($jmeno, $heslo, $email)
 {
     $mail = new Message();
     $mail->setFrom($this->mailerFromAddress)->setSubject('Registrace na stránkách SVJ Čiklova 647/3');
     $mail->addTo($email, $jmeno);
     $latte = new \Latte\Engine();
     $params = array('email' => $email, 'heslo' => $heslo);
     $mail->setHtmlBody($latte->renderToString(self::templateFolder . 'novyucet.latte', $params));
     $this->mailer->send($mail);
     return 1;
 }
开发者ID:bkralik,项目名称:BarakIS,代码行数:21,代码来源:DruzstvoMailer.php

示例6: processForm

 /**
  * @param UI\Form $form
  */
 public function processForm(UI\Form $form)
 {
     $values = $form->getValues();
     $template = $this->createTemplate();
     $mail = new Message();
     $template->setFile(__DIR__ . '/../presenters/templates/Emails/contactForm.latte');
     $mail->addTo($this->settings['adminMail'])->setFrom($values['email']);
     $template->title = 'Zpráva z kontaktního formuláře';
     $template->values = $values;
     $mail->setHtmlBody($template);
     $this->mailer->send($mail);
     $this->flashMessage('Zpráva byla odeslána');
     $this->presenter->redirect('Pages:view', ['id' => $this->settings['thanksPage']]);
 }
开发者ID:svatekr,项目名称:rsrs,代码行数:17,代码来源:ContactControl.php

示例7: send

 /**
  * @param Message $mail
  * @param string $body
  * @param array|NULL $params
  */
 public function send(Message $mail, $body = NULL, array $params = NULL)
 {
     if ($body) {
         $latte = $this->latteFactory->create();
         $latte->setLoader(new StringLoader());
         $latte->addProvider('uiControl', $this->linkGenerator);
         UIMacros::install($latte->getCompiler());
         $params = (array) $params;
         // can be NULL
         $html = $latte->renderToString($body, $params);
         $mail->setHtmlBody($html);
     }
     $this->mailer->send($mail);
 }
开发者ID:b4nan,项目名称:utils,代码行数:19,代码来源:MailSender.php

示例8: sendMail

 private function sendMail($values)
 {
     $mail = new Message();
     $mail->setSubject('Nová zpráva z kontaktního formuláře');
     $mail->setFrom($values['email'], $values['name']);
     $mail->addTo('feedback@zlomky-hrave.cz', 'Feedback form');
     $template = $this->createTemplate();
     $template->setFile(__DIR__ . '/templates/Mail.phtml');
     $template->name = $values['name'];
     $template->email = $values['email'];
     $template->text = $values['text'];
     $mail->setHtmlBody($template);
     $mailer = new SendmailMailer();
     $mailer->send($mail);
 }
开发者ID:amertak,项目名称:Fractions,代码行数:15,代码来源:ContactPresenter.php

示例9: processContactForm

 /**
  * Process contact form, send message
  * @param Form
  */
 public function processContactForm(Form $form)
 {
     $values = $form->getValues(TRUE);
     $mail = new Message();
     $mail->setFrom($values['email'])->addTo('patrik.zizka.s@gmail.com')->setSubject('Zpráva z kontaktního formuláře');
     $template = $this->createTemplate();
     $template->setFile(__DIR__ . '/templates/mail/emailTemplate.latte');
     $template->title = 'Zpráva z kontaktního formuláře';
     $template->values = $values;
     $mail->setHtmlBody($template);
     $mailer = new SendmailMailer();
     $mailer->send($mail);
     $this->flashMessage('Zpráva byla úspěšně odeslána', 'alert-success');
     $this->redirect('this');
 }
开发者ID:pzdesign,项目名称:patrik-zizka-nette,代码行数:19,代码来源:HomepagePresenter.php

示例10: bindMessage

 public function bindMessage(Mail\Message $message, array $data = [], $assetsDir = NULL)
 {
     if ($this->plain) {
         if ($this->plain instanceof UI\ITemplate) {
             $this->bindNetteTemplate($this->plain, $data);
         }
         $message->setBody($this->plain);
     }
     if ($this->html) {
         if ($this->html instanceof UI\ITemplate) {
             $this->bindNetteTemplate($this->html, $data);
         }
         $message->setHtmlBody($this->html, $assetsDir);
     }
 }
开发者ID:h4kuna,项目名称:mail-manager,代码行数:15,代码来源:Layout.php

示例11: prepareMailMessage

 /**
  * @param $templateName
  * @param array $params=[]
  * @return Message
  */
 private function prepareMailMessage($templateName, $params = [])
 {
     //připravení šablony a naplnění parametry
     $template = $this->createTemplate();
     //připravení mailu
     $mailMessage = new Message();
     $template->setFile(__DIR__ . '/mail' . $templateName . '.latte');
     if (!empty($params)) {
         foreach ($params as $paramName => $param) {
             $template->{$paramName} = $param;
         }
     }
     $template->mail = $mailMessage;
     $mailMessage->setFrom($this->mailFrom);
     $mailMessage->setHtmlBody($template);
     return $mailMessage;
 }
开发者ID:kizi,项目名称:easyminer-easyminercenter,代码行数:22,代码来源:MailerControl.php

示例12: send

 /**
  * Render latte template to string and send (and/or log) mail
  * @return void
  */
 public function send()
 {
     /**
      * Set template variables
      */
     $this->setTemplateVariables();
     /**
      * Set body/html body
      */
     try {
         $this->template->setFile($this->getTemplateFile());
         if (version_compare(Latte\Engine::VERSION, '2.4.0', '>=')) {
             $this->template->getLatte()->addProvider('uiControl', $this->linkGenerator);
         } else {
             $this->template->_control = $this->linkGenerator;
         }
         $this->message->setHtmlBody((string) $this->template, $this->mail_images_base_path);
     } catch (MailingException $e) {
         /**
          * If mail template was set and not found, bubble exception up
          */
         if ($this->template_file) {
             throw $e;
         }
         /**
          * Otherwise just suppose that user has set message body via ::setBody
          */
     }
     /**
      * In case mail sending in on, send message
      */
     if ($this->config === self::CONFIG_BOTH || $this->config === self::CONFIG_SEND) {
         $this->mailer->send($this->message);
     }
     /**
      * In case mail logging is turned on, log message
      */
     if ($this->config === self::CONFIG_LOG || $this->config === self::CONFIG_BOTH) {
         $this->logger->log($this->log_type, $this->message);
     }
 }
开发者ID:ublaboo,项目名称:mailing,代码行数:45,代码来源:Mail.php

示例13: 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

示例14: mailNotify

 /**
  * Notify an humean on email
  *
  * @param $subject
  * @param $message
  * @param array $data
  */
 public function mailNotify($subject, $message, $data = array())
 {
     $table = "<table>\n";
     foreach ($data as $key => $value) {
         try {
             $value = (string) $value;
         } catch (\Exception $e) {
             $value = "<i>hodnota není text</i>";
         }
         $table .= "<tr><th>{$key}</th><td>{$value}</td></tr>\n";
     }
     $table .= "</table>\n";
     $message = "<p>{$message}</p>\n\n";
     if (count($data)) {
         $message .= "<p>Tabulka dat:</p>\n{$table}";
     }
     $mail = new Nette\Mail\Message();
     $mail->setSubject($subject);
     $mail->setHtmlBody($message);
     $mail->addTo(self::NOTIFY_EMAIL_ADDRESS);
     $mailer = new Nette\Mail\SendmailMailer();
     $mailer->send($mail);
 }
开发者ID:vladimirslevercz,项目名称:sos,代码行数:30,代码来源:BasePresenter.php

示例15: send

 /**
  * Render latte template to string and send (and/or log) mail
  * @return void
  */
 public function send()
 {
     /**
      * Set template variables
      */
     $this->setTemplateVariables();
     /**
      * Set body/html body
      */
     try {
         $this->template->setFile($this->getTemplateFile());
         $this->message->setHtmlBody((string) $this->template, $this->mail_images_base_path);
     } catch (MailException $e) {
         /**
          * If mail template was set and not found, bubble exception up
          */
         if ($this->template_file) {
             throw $e;
         }
         /**
          * Otherwise just suppose that user has set message body via ::setBody
          */
     }
     /**
      * In case mail sending in on, send message
      */
     if ($this->config === self::CONFIG_BOTH || $this->config === self::CONFIG_SEND) {
         $this->mailer->send($this->message);
     }
     /**
      * In case mail logging is turned on, log message
      */
     if ($this->config === self::CONFIG_LOG || $this->config === self::CONFIG_BOTH) {
         $this->logger->log($this->log_type, $this->message);
     }
 }
开发者ID:JakubKontra,项目名称:mailing,代码行数:40,代码来源:Mail.php


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