/**
  * Compile email message
  *
  * @param EmailTemplateInterface $template
  * @param array                  $templateParams
  *
  * @return array first element is email subject, second - message
  */
 public function compileMessage(EmailTemplateInterface $template, array $templateParams = array())
 {
     // ensure we have no html tags in txt template
     $content = $template->getContent();
     $content = $template->getType() == 'txt' ? strip_tags($content) : $content;
     $templateParams['user'] = $this->user;
     $templateRendered = $this->render($content, $templateParams);
     $subjectRendered = $this->render($template->getSubject(), $templateParams);
     return array($subjectRendered, $templateRendered);
 }
Пример #2
0
 /**
  * @param EmailTemplateInterface $emailTemplate
  * @return string
  */
 protected function getEmailTemplateType(EmailTemplateInterface $emailTemplate)
 {
     return $emailTemplate->getType() === 'txt' ? 'text/plain' : 'text/html';
 }