If anyone's interested, I've found a workable solution: <?php
$mail_view = clone $this->view; $mail_view->clearVars(); $mail = new Zend_Mail( 'UTF-8' ); $mail->setBodyHtml( $mail_view->render( $this->getHelper( 'ViewRenderer' )->getViewScript( 'emails/client' ) ) ); ?> This code is placed within an action method. Cloning the controller's view object allows me to use the automatically generated paths for the view rather than build them up from scratch myself. So, the view script that gets rendered might be something like "/application/views/scripts[controller]/[action]/emails/client.[suffix]" or, if within a module, "/application/modules/[module]/views/scripts[controller]/[action]/emails/client.[suffix]". This only works because ViewRenderer::getViewScript() accepts directory separators in the action name. That seems odd to me, but I'm thankful for it at the moment. On Wed, Feb 24, 2010 at 9:46 PM, Ryan Lange <cl1mh422...@gmail.com> wrote: > Using the Zend_Application and the whole MVC shebang I have a controller > action that needs to assemble and send an HTML email. I want to use > Zend_View to render the body of the email and would like to keep the view > script in a subfolder of the controller's view script folder. > > I understand that the ViewRenderer action helper is responsible for setting > the script path based on module/controller when "auto-rendering", but I'm > not sure how to use that to my advantage for mid-action rendering, or if > it's even possible. > > I could set the script path manually, but I was hoping for an easier and > less error-prone (say, in the event of a refactoring) method. > > > Thanks in advance, > Ryan >