|
From: Rob H. <ro...@ca...> - 2004-07-21 13:08:46
|
Well that is easy, but you need to create and configure an instance of VelocityEngine before you can use that, and that may lead to the bad practice of creating and initializing a new instance once per message. = It would be a trivial job to abstract all this away, plus then we could add support for other templating engines. Rob -----Original Message----- From: spr...@li... [mailto:spr...@li...] On Behalf = Of j=FCrgen h=F6ller [werk3AT] Sent: 21 July 2004 13:40 To: spr...@li... Subject: Re: [Springframework-developer] E-Mail Templating Support That's already pretty easy: You can generate the email text with the "mergeTemplateIntoString" of Spring's VelocityTemplateUtils helper, and = pass the result String into SimpleMailMessage's or MimeMessageHelper's = setText methods. 1 line to render the template (passing in a model Map), 1 line = to use it as email text for a given message. Juergen -----Original Message----- From: spr...@li... [mailto:spr...@li...]On Behalf Of Colin Sampaleanu Sent: Wednesday, July 21, 2004 1:36 PM To: spr...@li... Subject: Re: [Springframework-developer] E-Mail Templating Support It seems like a good number of the relatively complex j2ee apps=20 eventually end up rolling their own version of something like this (I=20 know we did at one of my last gigs, although that was before spring), so = if you can come up with a decent abstraction this would be worthwhile. Rob Harrop wrote: > I have been thinking of adding templated e-mail support to the mail=20 > package in Spring. In this way you can create the body of the mail as=20 > a Velocity template, and have data passed into the mail at runtime to=20 > customize it. I need to think a little more about how this would be=20 > implemented but I think the idea is sound. What does everyone else = think? > > =20 > > Rob > ------------------------------------------------------- This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools! Get your free copy of BEA WebLogic Workshop 8.1 today. http://ads.osdn.com/?ad_id=3D4721&alloc_id=3D10040&op=3Dclick _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer ------------------------------------------------------- This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools! Get your free copy of BEA WebLogic Workshop 8.1 today. http://ads.osdn.com/?ad_idG21&alloc_id=10040&op=3Dick _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |