Ejemplo n.º 1
0
 /**
  * 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);
     }
 }
Ejemplo n.º 2
0
 /**
  * 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);
     }
 }