Email Notification template | Community
Skip to main content
September 2, 2022
Solved

Email Notification template

  • September 2, 2022
  • 4 replies
  • 3314 views

Hi, 

When I am trying to send the email notification template in a workflow, it always points towards 

/libs/settings/workflow/notification/email/default/en.txt  template but it is not a good practice to make any changes in libs if I have to modify the template. 

Could anyone help me know is there any other way that how to customize the new email template and redirect workflow towards it ? 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Timo_HH

In AEM 6.5.20 the class com.day.cq.workflow.impl.email.EMailNotificationService tries to find the email templates first here:

String templateLocation = "/etc/workflow/notification/email/default";

 If this location does not exist, it takes '/libs/settings/workflow/notification/email/default' as default path.

 

So for overlaying the email templates to create custom emails, you can copy '/libs/settings/workflow/notification/email/default' to '/etc/workflow/notification/email/default' and adjust it there.
No service restarts required.

In AEM 6.5.20 this worked. For lower AEM versions please try on your own.

4 replies

Adobe Employee
September 2, 2022

You can overlay it under /apps and workflow would automatically pick anything under /apps over /libs (If cloud impl ) . E.g. for asset expiry notification we overlayed /libs/settings/dam/notification/email/default/com.adobe.cq.dam.asset.expiry.prior/en.txt to 

/apps/settings/dam/notification/email/default/com.adobe.cq.dam.asset.expiry.prior/en.txt and added our own text/html.

lukasz-m
Community Advisor
Community Advisor
September 2, 2022

Hi @khasinaparveen,

According to the official documentation:

Template for email workflow notification can be changed only under /libs. Overlay of /libs/settings/workflow/notification/email/default/en.txt will not work because com.day.cq.workflow.impl.email.EMailNotificationService which is responsible to sent an email has hardcoded path to /libs/settings/workflow/notification/email/default.

Alternatively you can try to extend EMailNotificationService and change location of template to use your custom location.

Adobe Employee
September 2, 2022

Okay , we did use it recently and it worked for us (on cloud) , you may want to check that.

lukasz-m
Community Advisor
Community Advisor
September 2, 2022

You are right, in cloud setup EMailNotificationService implementation has changed a bit. So overlay could work in AEM as a Cloud Service, but for on-prem version 6.5 and 6.4 it will not, due to the reason I have described in my previews message.

Timo_HHAccepted solution
November 18, 2024

In AEM 6.5.20 the class com.day.cq.workflow.impl.email.EMailNotificationService tries to find the email templates first here:

String templateLocation = "/etc/workflow/notification/email/default";

 If this location does not exist, it takes '/libs/settings/workflow/notification/email/default' as default path.

 

So for overlaying the email templates to create custom emails, you can copy '/libs/settings/workflow/notification/email/default' to '/etc/workflow/notification/email/default' and adjust it there.
No service restarts required.

In AEM 6.5.20 this worked. For lower AEM versions please try on your own.

November 19, 2024

"No service restarts required." is not correct. The folders are read during service activation. So the service/instance needs a restart.
Enabling a debug log for com.day.cq.workflow.impl.email.EMailNotificationService shows which folder is used during service activation.

shikhasoni1
January 30, 2025

Hi @khasinaparveen 

 

Did the solution work for you. If yes could you mind sharing the workflow code here please.