On Mon, Aug 31, 2009 at 4:01 PM, David Mintz <[email protected]> wrote:
> > > On Sun, Aug 30, 2009 at 9:31 AM, fab2008 <[email protected]> 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? >> >> > [Damn this gmail! your focus accidentally gets on the send button and you press the wrong key and presto! your email is sent prematurely, speaking of email. Hate it when that happens. Anyway, I meant to say...] $this->_helper->layout->setLayout('foobaz'); $mailer = new Zend_Mail(); $mailer->addTo( $user->email, "$user->firstname $user->lastname" ) ->setBodyHtml( $this->view->render( 'your/view.phtml' ) ) ->setFrom ( '[email protected]', "Whomever" ) ->setSubject ( "Your subject line" ) ->send (); HTH. -- David Mintz http://davidmintz.org/ The subtle source is clear and bright The tributary streams flow through the darkness
