José Ignacio Seluy
03/13/2025, 12:49 PMmailService.sendMail {
to "<mailto:your@name.com|your@name.com>"
from "fromEmail"
subject "titleMail"
html view: "/email/auth/verificationCode", model: [:]
}
i get the following error:
Could not locate mail body /email/auth/verificationCode. Is it in a plugin? If so you must pass the plugin name in the [plugin] variable.
The view file is located at: grails-app/views/email/auth/verificationCode.gsp
The error is thrown when I run the project with the generated war.
I found that the plugin searchs for the file under "`/WEB-INF/grails-app/views/email/auth/verificationCode.gsp`"
BUT the generated war saves the file under "`WEB-INF/classes/email/auth/verificationCode.gsp`"
So I was wondering why the war structure changed from /WEB-INF/grails-app/views to WEB-INF/classes/.
Is it related to the change of project type (now rest-api and before web-app)?
If so, what other changes should I be aware of regarding this new project type?
And finally, but most important, how can I solve this issue to be able to use the Mail plugin?
Thank you all!
Slack Conversationtylervz
03/13/2025, 3:13 PM./gradlew bootRun and when running the myapp-6.0.7-plain.war file on Tomcat that was generated via ./gradlew assemble.
The only difference that stands out to me is your view file is nested one directory level deeper than mine; my file is located at grails-app/views/correspondence/mobileVerificationCodeEmail.gsp. I would try moving your file to grails-app/views/email/verificationCode.gsp (and obviously change your mailService call so it includes html view: "/email/verificationCode", model: [:]) and see if that resolves the problem. I seem to remember having troubles before with JSON views (.gson) that were in a nested directory structure...