When using the ootb core forms container and action type as "Mail" I am able to send the email from AEM but I would like to create my own custom email template for my use case. Can anybody point me at email template I would need to override or which template Forms Container uses to send the emails inside AEM. I know we can create our own email service and have custom template but I am more curious to know if we can override ootb email template.
Solved! Go to Solution.
Views
Replies
Total Likes
The email body is built in com.day.cq.wcm.foundation.forms.impl.MailServlet. You cannot just override the template here, you need to create your own custom servlet for the "Mail" action.
To create your custom servlet for mail action,
FormsHelper.setForwardPath(slingRequest, resource.getPath() + ".XYZ.html");
@Component(service = Servlet.class,This thread might help you. Do let me know if you have further queries.
property = {
"sling.servlet.resourceTypes=" + "foundation/components/form/start",
"sling.servlet.resourceTypes=" + "core/wcm/components/form/container/v2/container",
"sling.servlet.methods=" + "POST",
"sling.servlet.selectors=" + "XYZ",
"service.description=" + "Form Mail Servlet"
})
The email body is built in com.day.cq.wcm.foundation.forms.impl.MailServlet. You cannot just override the template here, you need to create your own custom servlet for the "Mail" action.
To create your custom servlet for mail action,
FormsHelper.setForwardPath(slingRequest, resource.getPath() + ".XYZ.html");
@Component(service = Servlet.class,This thread might help you. Do let me know if you have further queries.
property = {
"sling.servlet.resourceTypes=" + "foundation/components/form/start",
"sling.servlet.resourceTypes=" + "core/wcm/components/form/container/v2/container",
"sling.servlet.methods=" + "POST",
"sling.servlet.selectors=" + "XYZ",
"service.description=" + "Form Mail Servlet"
})