In this case, I simply render the view in an EmailService component - yes, within a method called renderEmail.
On Wed, Mar 28, 2012 at 6:51 PM, Dan Wilson <[email protected]> wrote: > Hmm.. this is an interesting use case. The ModelGlue framework handles > everything in a Post/Response manner, meaning the output of the request > fills the buffer with content to go back to the client. > > What you are trying to do is use the views of Model Glue in a way in which > they were not intended. Sure you could do this in a service, but I'm > assuming there is some value to using the results to add the right content > to the view. > > I'm not in a position to work up a model for how to do this, but if you > are sure this is what you want to do, you may consider using some of the > view methods on the EventContext (Event) object. > > Look at: > > getView > AddView > renderView > getViewCollection > > I'm sure you can piece these together to do something programmatic for > your use case. Please report back your findings or any questions you have. > > > DW > > > > On Wed, Mar 28, 2012 at 12:41 PM, marc <[email protected]> wrote: > >> Hi, >> >> Currently I send an email by specifying an e-mail template in the <view> >> section of my event-handler xml. >> This email-template contains my html, links to graphics,css includes etc >> in a <cfsavecontent> block. Below that block I use a <cfmail> tag that has >> the value of the <cfsavecontent> as the emailbody. So trhe email gets sent >> from a view. Rather kludgy but it works. >> >> Now I want to send e-mails from within a loop, that is in a controller. >> The previous method is not usable here. Is the following possible: >> >> within every the loop iteration >> set text in the event scope - event.setvalue("text",<emailtext>); >> render a view (or multiple views in case of layouts) The views access the >> keys set in the loop; >> use that rendered html as the body of the <cfmail> tag >> >> So I can send multiple emails from within the controller, just have to >> specify a special email layout. >> >> I hope this is clear. >> >> Most likely this is possible but I can't find examples or entries in the >> howto that describe this. >> >> Thanks, >> >> Marc >> >> -- >> Model-Glue Sites: >> Home Page: http://www.model-glue.com >> Documentation: http://docs.model-glue.com >> Bug Tracker: http://bugs.model-glue.com >> Blog: http://www.model-glue.com/blog >> >> You received this message because you are subscribed to the Google >> Groups "model-glue" group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/model-glue?hl=en > > > > > -- > Plutarch - "The mind is not a vessel to be filled but a fire to be > kindled." > > -- > Model-Glue Sites: > Home Page: http://www.model-glue.com > Documentation: http://docs.model-glue.com > Bug Tracker: http://bugs.model-glue.com > Blog: http://www.model-glue.com/blog > > You received this message because you are subscribed to the Google > Groups "model-glue" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/model-glue?hl=en > -- Nando M. Breiter The CarbonZero Project CP 234 6934 Bioggio Switzerland +41 91 606 6372 [email protected] www.carbonzero.ch -- Model-Glue Sites: Home Page: http://www.model-glue.com Documentation: http://docs.model-glue.com Bug Tracker: http://bugs.model-glue.com Blog: http://www.model-glue.com/blog You received this message because you are subscribed to the Google Groups "model-glue" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/model-glue?hl=en
