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"
})
Is it still working for AEMaaCS? With overlayed forward.jsp I can see 302 redirect in browser but without selector defined so my servlet is not triggering.
Views
Replies
Total Likes
I haven't tried this in AEMaaCS. Works with AEM 6.5.
Views
Replies
Total Likes
Views
Likes
Replies