开发者

How to override the 'From' parameter in Grails mail plugin

After installing the grails mail plugin, when I tried to use the ff code:

mailService.sendMail {
  to recipients.to开发者_如何学GoArray()
  from "${userEmail}"
  subject "${url?.article?.title}"
  html g.render(template:"/promote/email_template", model: [newsUrl : newShortUrl, news : url?.article, comment: status, user : user, rootUrl : rootUrl])
}

But the from parameter return NOT the data of userEmail but of the email used in the config file. Is there a way to override this and use another data (the userEmail)?

I assumed that since the From parameter could be used, I can set it with whatever email the current user is using.


I use the from method successfully, but I also left out the grails.mail.default.from configuration. The docs say it should work as you expect. Is your outgoing SMTP server by chance overriding it back to your login?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜