Grails 尝试以电子邮件形式发送HTML内容时缺少属性异常
我正在渲染视图并尝试发送电子邮件。但出现以下错误:Grails 尝试以电子邮件形式发送HTML内容时缺少属性异常,grails,groovy,Grails,Groovy,我正在渲染视图并尝试发送电子邮件。但出现以下错误: Class groovy.lang.MissingPropertyException Message No such property: content for class: grails.plugin.mail.MailMessageBuilder 守则: def content=groovyPageRenderer.render view: '/email/mail', model: [username: u] if(mailServ
Class
groovy.lang.MissingPropertyException
Message
No such property: content for class: grails.plugin.mail.MailMessageBuilder
守则:
def content=groovyPageRenderer.render view: '/email/mail', model: [username: u]
if(mailService!=null){
mailService.sendMail {
to "mail@yahoo.com"
from "f@fff.com"
subject "rrr"
html(content)
}
我如何解决这个问题?这是我的代码示例
class FeedbackController {
def mailService // <-- Injection of mail service from the 'mail' plugin
def sendTestMsg() {
mailService.sendMail {
to "test@mail.test"
subject "Some important topic"
html g.render(template: "contactMailTemplate",
model: [remark: "Test one-two-three", yourname: "Testing bot", yourmail: "testbot@mail.test"])
}
render "success"
}
}
[%@ page contentType="text/html" %]
[html]
[head]
[title]Welcome Aboard[/title]
[style type="text/css"]
body {
font-family: "Trebuchet MS"
}
[/style]
[/head]
[body]
[h2]Question from users![/h2]
[p]
[strong]${yourname}[/strong] asked us from the [strong]${yourmail}[/strong] address
[/p]
[p]
${remark}
[/p]
[/body]
[/html]