[英]Grails 2.4.2 and mail plugin 1.0.6 error
Anyone else having issues with the mail plugin 1.0.6 and Grails 2.4.2? 邮件插件1.0.6和Grails 2.4.2是否还有其他问题?
This works fine: 这工作正常:
mailService.sendMail {
to "test@test.com"
bcc "test@test.com"
from "test@test.com"
subject "test"
body "test mail"
}
But when using view templates such as : 但是,当使用视图模板时,例如:
mailService.sendMail {
to "test@test.com"
bcc "test@test.com"
from "test@test.com"
subject "test"
html view:"/mail/test", model:[test:"test"]
}
I get "Cannot get property 'config' on null object errors" at 我收到“无法在空对象错误上获取属性'config'”
Around line 65 of MailMessageContentRenderer.groovy 在MailMessageContentRenderer.groovy的第65行周围
65: template.make(model).writeTo(out) 65:template.make(模型).writeTo(输出)
Not sure how to troubleshoot this. 不确定如何解决此问题。 Any advice appreciated. 任何建议表示赞赏。 I am trying to send from a controller. 我正在尝试从控制器发送。
Thanks, Jeff 谢谢杰夫
You need to render that template/view with the html
method: 您需要使用html
方法呈现该模板/视图:
sendMail {
to "john@g2one.com"
subject "Hello John"
html g.render(template:"myMailTemplate")
}
You can also use body
method like this: 您也可以这样使用body
方法:
sendMail {
to "john@g2one.com"
subject "Hello John"
body( view:"/emailconfirmation/mail/confirmationRequest",
plugin:"email-confirmation",
model:[fromAddress:'bill@microsoft.com'])
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.