如何使用 Grails 外部化 GSP 邮件模板?
当从模板呈现电子邮件时,会在“grails_app/views”中查找模板:
mailService.sendMail {
from sender
to recepient.email
subject "Don't forget"
body (view: "/emails/reminder",
model:[recepient: recepient, document: document])
}
如何将应用程序外部的邮件模板(war 文件)放入文件系统中?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有两个选项:
获得字符串后,您可以使用 Grails 控制器中的 GSP 引擎和任意字符串来创建视图。有关更多详细信息,请参阅此博文 。
简而言之,您可以使用列出的选项之一将模板存储为字符串,然后在检索模板字符串后使用 Grails GSP 引擎创建视图。
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.