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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With