Email body in Symfony 1.4 mailer?

◇◆丶佛笑我妖孽 提交于 2019-11-30 10:46:40

I store the email bodies as a template file and render them via sfPartialView. E.g. inside an action:

$view = new sfPartialView($this->getContext(), $this->getModuleName(), $this->getActionName(), 'confirmation_mail');
$view->setTemplate('_confirmation_mail.php');

// values can be set e.g. by setAttibute
$view->setAttribute('name', $name);

$body = $view->render()

The body templates are located in the module's template folder, but I am sure you can somehow change this and e.g. put all email templates into one folder if you want to.

How about just using the native method availible inside sfAction.

$this->getPartial('partial_name'); which works like the partial helpers for you templates.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!