I have email.ftl under modules/portal/web/WEB-INF/templates/email/ (a subfolder I created). In my controller code, I have my EmailInfo declaration, and I want to specify the path to email.ftl.
Looking at this tutorial, I see the EmailInfo declaration is this:
EmailInfo emailInfo = new EmailInfo( "email@example.com,firstname.lastname@example.org", newsItem.getCaption(), null, "com/company/demo/templates/news_item.txt", Collections.singletonMap("newsItem", newsItem) );
I notice the relative path leading to news_item.txt starts from “com/” which leads me to believe that the root of the path starts from the “src” folder of the module the controller is in (my controller is in app-portal, so in my case, portal/src). Since my template is under “web/” and not “src/”, I specified my path as so:
EmailInfo emailInfo = new EmailInfo("email@example.com", "Email Template", null, "../web/WEB-INF/templates/email/email.ftl", null, null);
However, it didn’t work, as an error was thrown:
java.lang.IllegalArgumentException: Could not find template by path: ../web/WEB-INF/templates/email/email.ftl
So my question is, how to specify this file path to go under a different subfolder, specifically “modules/portal/web”?
==X-posted to StackOverflow==