我有一個問題發送郵件,因爲symfony 2.8與SwiftMailer。 之前,我用這個方法:SwiftMailer setBody與數據庫
$body = $this->twig->render($email->getCorp());
隨着外部服務,但現在我有這個錯誤:
無法找到模板「
<div>
......在數據庫模板...」
我已經試過這也和我有同樣的錯誤:
$email = $em->getRepository('BoAdminBundle:Email')->find(3);
$body = $this->render($email->getCorp());
$message = Swift_Message::newInstance()
->setSubject('Subject')
->setFrom('[email protected]')
->setTo($insti->getEmail())
->setContentType("text/html")
->setBody($body);
$this->get('mailer')->send($message);
感謝您的幫助:)!
編輯:
$parametersFinal = array_merge($replaces, $replacesInsti); // $replacesInsti = array the client's informations
$body = $this->twig->render($email->getCorp(), $parametersFinal);
我怎樣才能在體內插入這種 「$ parametersFinal」?
'$ email-> getCorp()'返回什麼? –
數據庫中包含html消息(電子郵件正文)的字段。 – pouletomorilles
您的編輯似乎可能更好地作爲一個單獨的問題提供服務。 –