Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Customizing the default Page Replication email template

Avatar

Level 1

I need to put in a customized email template to be triggered on page deactivations. I am facing a few issues - can someone please help me with the following?

1. Instead of directly modifying the email template at: /etc/notification/email/default/com.day.cq.replication/en.txt, I was wondering whether I can put the modified template in a separate folder under /etc or in /apps and have the Day CQ mail service use that email template for notifications instead of the default one - similar to overlaying for components.

2. I need a variable on the customized email template for the page title but the default template mentioned above doesn't have one. Is there any other way to include the page title in the template?

3. The default mail template has the "host.prefix" variable, but even though I have already defined the value of the variable in com.day.cq.workflow.impl.email.EMailNotificationService and also in com.day.cq.workflow.impl.email.TaskEMailNotificationService the notifications with the default template continue to come in without the "host.prefix" variable being resolved. Please refer to the screenshot below:

1336743_pastedImage_14.png

6 Replies

Avatar

Level 10

You can populate any variable in a email template using a Java MAP. See:

//Populate the MAP with the values submitted from the HTL front end

              myMap.put("topic.subject",TopicSubject);

              myMap.put("time",timeStamp);

              myMap.put("host.prefix",hostPrefix);

              myMap.put("forum.url",forumUrl);

              myMap.put("modifiedBy.fullname",modifiedByFullname);

              myMap.put("topic.url",topicUrl);

              myMap.put("post.message",message);

The Java code is explained in this article -- Adobe Experience Manager Help | Creating Adobe Experience Manager HTL Components that send Email mes...

Avatar

Level 10

Also - as you can see in that article - you can put the email template where you want in the JCR. You reference it via the Java code:

//Specify the EMail template

             String template ="/etc/notification/email/html/com.day.cq.collab.forum/en.txt";

Avatar

Level 1

@smacdonald2008,

We want to customize the page deactivation notification. How do we pass the java parameter map in that case? We don't want to modify any workflows right now.

Avatar

Level 10

You would need to modify the page deactivation workflow. You can use a custom email template and in your Java logic - setup a Map - as shown in the article - with variable values. 

Avatar

Level 10

Hi,

Yes, Scott is correct. You need to modify the page deactivation workflow and use custom email template as described in the below said article.

Adobe Experience Manager Help | Creating Adobe Experience Manager HTL Components that send Email mes...

~Ratna.

Avatar

Level 1

Thanks smacdonald2008 and Ratna,

Sorry, I was not aware that page deactivation also triggered a workflow. I thought it was only the Request to (un)publish and the (Un)Publish Later options that triggers a workflow. Can you give me the exact name/PID for the deactivation workflow?