[英]Grails 2.4.2 and mail plugin 1.0.6 error
郵件插件1.0.6和Grails 2.4.2是否還有其他問題?
這工作正常:
mailService.sendMail {
to "test@test.com"
bcc "test@test.com"
from "test@test.com"
subject "test"
body "test mail"
}
但是,當使用視圖模板時,例如:
mailService.sendMail {
to "test@test.com"
bcc "test@test.com"
from "test@test.com"
subject "test"
html view:"/mail/test", model:[test:"test"]
}
我收到“無法在空對象錯誤上獲取屬性'config'”
在MailMessageContentRenderer.groovy的第65行周圍
65:template.make(模型).writeTo(輸出)
不確定如何解決此問題。 任何建議表示贊賞。 我正在嘗試從控制器發送。
謝謝傑夫
您需要使用html
方法呈現該模板/視圖:
sendMail {
to "john@g2one.com"
subject "Hello John"
html g.render(template:"myMailTemplate")
}
您也可以這樣使用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.