What Is The Best Way To Generate Html Mail Templates For The Grails Mail Plugin?
With the Grails Mail plugin you can either send plain text or html mails. When sending html mails like this: sendMail { to 'fred@g2one.com' subject 'Hello John' html(view: h
Solution 1:
Templates can include other templates using the g:render
tag.
If you don't want the inline css mixed with your mail html, place it in its own template and use the render tag to insert it into the html template:
mail/_css.gsp:
<styletype="text/css">body {
/* styles! */
}
</style>
mail/_message.gsp:
<html><head><g:rendertemplate="/mail/css" /><!-- render stylesheet into this template --></head><body><!-- content --></body></html>
Solution 2:
I created a gist on how to do it following a good pattern.
Post a Comment for "What Is The Best Way To Generate Html Mail Templates For The Grails Mail Plugin?"