Email body in Symfony 1.4 mailer?

前端 未结 2 1880
野的像风
野的像风 2021-01-01 06:08

I\'m using the Symfony 1.4 mailer where I build the various bits needed for an email and then send it out using:

$this->getMailer()->composeAndSend($se         


        
相关标签:
2条回答
  • 2021-01-01 06:45

    How about just using the native method availible inside sfAction.

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

    0 讨论(0)
  • 2021-01-01 07:12

    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.

    0 讨论(0)
提交回复
热议问题