Ano_ZFTwig
Ano_ZFTwig copied to clipboard
\Zend_Layout replacement for sending a html mail?
Salut, j'ai un problème avec la librairie quand je veux l'utiliser pour envoyer un mail en html.
Ma méthode qui me permet de définir le layout du mail:
public function sendHtmlTemplate($template, $encoding = \Zend_Mime::ENCODING_8BIT) { // create a layout object and set it to app_path/emails/layouts $layout = new \Zend_Layout(array( 'layoutPath' => APPLICATION_PATH . '/layouts/scripts' ));
$layout->content = self::getDefaultView()->render($template);
//$layout->setView($layout->content); // this probably isn't even necessary
// render html version of template & assign to output['html']
$layout->setLayout('email.phtml');
$html = $this->_view->render($template);
$this->setBodyHtml($html, $this->getCharset(), $encoding);
$this->send();
}