Mailing the GSP in Grails with the Mail plugin
I´m sending an email with the Mail Plugin for Grails of a GSP. In this GSP I have added images us开发者_C百科ing ...
src="${resource(dir:'img', file:'line.jpg')}"
... for example but when I get the email the links seems like they are broken. I think it´s beacause the resources from the Grails project aren´t attached to the mail when this one is created.
Could it be anything else? What can I do to attach the resources files to the email with the plugin or any other way?
Looks like Grails' mail plugin has recently added a way to inline images in 1.0 version.
inline()
method must work - let me guess how the syntax should look:
mailService.sendMail {
to m.email
subject m.emailSubject
body m.emailBody
inline 'mylogo', new File(path)
}
where mylogo
is resource id that should be referred in m.emailBody
like:
<img src="mylogo" />
There was a historical way on maillist, but hopefully now you don't need to hack a plugin.
src="${resource(dir:'img', file:'line.jpg', absolute: 'true')}"
精彩评论