Expand my Community achievements bar.

Join us in celebrating the outstanding achievement of our AEM Community Member of the Year!
SOLVED

Email notification template can't be changed for workflow notification

Avatar

Former Community Member

I need to change email notification, while the workflow is start. I have changed the email template in /etc/workflow/notification/email/default/en.txt. But the email content is not changed, it still send the default email.

 

And now when I start workflow, I don't even get the email notification even though I checked "notify via email" option.

 

Anyone facing the same issue ?

 

Please help

1 Accepted Solution

Avatar

Correct answer by
Administrator

Hi Rad

 

The process of customizing Template for Workflow notification is same as mentioned by you.

For more clarity I will mention briefly the steps to do so.

 

In CRXDE, open the en.txt file located below the /etc/workflow/notification/email/default node.

Modify the file to your needs.

Save the changes.

 

Precaution

The template needs to have the following format:

subject=<text_1>
header=<text_2>
message=<text_3>
footer=<text_4>

Where <text_x> can be a mix of static text and dynamic string variables. Each line of an <text_x> needs to be ended with a backslash (\), except the last one: the absence of the backslash indicates the end of the <text_x> string variable. More information about the template format can be found in the javadocs of the Properties.load() method.

Reference Article: - https://docs.adobe.com/docs/en/cq/5-6-1/administering/notification.html

 

Option 2

We can create an AEM workflow steps that can send email messages.Here we create an OSGI bundle, which will help us in sending the email.

 

//Code Snippet

public void execute(WorkItem item, WorkflowSession wfsession,MetaDataMap args) throws WorkflowException {

    //Declare a MessageGateway service

    MessageGateway<Email> messageGateway;          

    //Set up the Email message

    Email email = new SimpleEmail();   

    //Set the mail values

    String emailToRecipients = "tblue@nomailserver.com";

    String emailCcRecipients = "wblue@nomailserver.com";

   

    email.addTo(emailToRecipients);

    email.addCc(emailCcRecipients);

    email.setSubject("AEM Custom Step");

    email.setFrom("scottm@adobe.com");

    email.setMsg("This message is to inform you that the CQ content has been deleted");

      

    //Inject a MessageGateway Service and send the message

    messageGateway = messageGatewayService.getGateway(Email.class);

    // Check the logs to see that messageGateway is not null

    messageGateway.send((Email) email);

}

}

To execute option 2, please refer to the article covering step by step above stated.

Reference Article: - https://helpx.adobe.com/experience-manager/using/creating-custom-aem-workflow-steps.html

 

I hope this will solve your problem.

 

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

View solution in original post

1 Reply

Avatar

Correct answer by
Administrator

Hi Rad

 

The process of customizing Template for Workflow notification is same as mentioned by you.

For more clarity I will mention briefly the steps to do so.

 

In CRXDE, open the en.txt file located below the /etc/workflow/notification/email/default node.

Modify the file to your needs.

Save the changes.

 

Precaution

The template needs to have the following format:

subject=<text_1>
header=<text_2>
message=<text_3>
footer=<text_4>

Where <text_x> can be a mix of static text and dynamic string variables. Each line of an <text_x> needs to be ended with a backslash (\), except the last one: the absence of the backslash indicates the end of the <text_x> string variable. More information about the template format can be found in the javadocs of the Properties.load() method.

Reference Article: - https://docs.adobe.com/docs/en/cq/5-6-1/administering/notification.html

 

Option 2

We can create an AEM workflow steps that can send email messages.Here we create an OSGI bundle, which will help us in sending the email.

 

//Code Snippet

public void execute(WorkItem item, WorkflowSession wfsession,MetaDataMap args) throws WorkflowException {

    //Declare a MessageGateway service

    MessageGateway<Email> messageGateway;          

    //Set up the Email message

    Email email = new SimpleEmail();   

    //Set the mail values

    String emailToRecipients = "tblue@nomailserver.com";

    String emailCcRecipients = "wblue@nomailserver.com";

   

    email.addTo(emailToRecipients);

    email.addCc(emailCcRecipients);

    email.setSubject("AEM Custom Step");

    email.setFrom("scottm@adobe.com");

    email.setMsg("This message is to inform you that the CQ content has been deleted");

      

    //Inject a MessageGateway Service and send the message

    messageGateway = messageGatewayService.getGateway(Email.class);

    // Check the logs to see that messageGateway is not null

    messageGateway.send((Email) email);

}

}

To execute option 2, please refer to the article covering step by step above stated.

Reference Article: - https://helpx.adobe.com/experience-manager/using/creating-custom-aem-workflow-steps.html

 

I hope this will solve your problem.

 

Thanks and Regards

Kautuk Sahni



Kautuk Sahni