On Sun, Aug 30, 2009 at 9:31 AM, fab2008 <f.napole...@gmail.com> wrote:
> > Hi all, > > I have a page with some news generated using ZF stack (Zend_MVC, > Zend_Layout, Zend_View, Zend_Navigation, etc); this page is available for > web browsing, but I need also to email this page with some additional info. > Suppose I have a link like "Send this page to a friend" that bring to a > form > with from and to fields and a name field. When an user fill this form I > want > to email the complete news page (possibly using a different layout) with an > header div that says "This page was sent to you by <friend_name> > <friend_email>". > > I want to avoid duplication of code, so I want to use the same > implementation of the web page, but i need the generated content in a > string, in this way I can email the generated HTML. > > Which is the best way for doing this in a controller action? > > within a controller action, I have done something like $this->_helper->layout->setLayout('foobaz'); $mailer = new Zend_Mail( ); $mailer->addTo( $user->email, "$user->firstname $user->lastname" ) ->setBodyText ( $this->view->render( 'your/view.phtml' ) ) ->setFrom ( 'interpret...@nysd.uscourts.gov', "Southern District Interpreters" )->setSubject ( "SDNY Interpreters: Password Retrieval" )->send (); } -- David Mintz http://davidmintz.org/ The subtle source is clear and bright The tributary streams flow through the darkness