For my email newsletter I need to render a GSP (the HTML for the newsletter) as a String
, so I can pass it to my email method. I’ve found many solutions here o
In Grails 2.x, you can inject a groovyPageRenderer
into a service. This allows you to render any view or template you want via its render()
method.
For more information, check out this nice post from Mr. Haki.
Also note that if you’re using the Mail plugin, you can use a view for your email body.