Reputation: 92437
When emails are rendered from templates, the templates are looked up in "grails_app/views":
mailService.sendMail {
from sender
to recepient.email
subject "Don't forget"
body (view: "/emails/reminder",
model:[recepient: recepient, document: document])
}
How can I put the mail templates outside of the application (war file) into the file system?
Upvotes: 8
Views: 2549
Reputation: 39887
There are two options:
Once you have your string, you can use the GSP engine from a Grails controller with any arbitrary string to create a view. See this blog post for more details.
In short, you would store your template as a string using one of the listed options and then use the Grails GSP engine to create the view once you retrieved the template string.
Upvotes: 8