April 14, 2020
Estimated Post Reading Time ~

Creating Adobe Experience Manager HTL Components that send Email messages based on templates

You can create an Adobe Experience Manager (AEM) HTML Template Language (HTL) component that lets web site visitors populate a form and submit the data. The OSGi bundle contains a Sling Servlet that sends an email message to email recipients. The email message is based on an AEM email template that is located in the AEM JCR repository.

An email template is simply a text file located in the AEM JCR. For example, consider the following template.

<html>
<body>
<p>
<b>Time:</b> ${time}
Forum URL: ${host.prefix}${forum.url}
</p>
A new reply was posted by ${modifiedBy.fullname} for CQ Forum topic "${topic.subject}".
-------------------------------------------------------------------------------------
${post.message}
-------------------------------------------------------------------------------------
This is an automatically generated message. Please do not reply.
Please follow this link to view all replies to this topic.
${host.prefix}${topic.url}
</body>
</html>

Email templates are located at the following JCR location:
/etc/notification/email

An email template is a JCR node of type nt:file. Each node has a text file as shown in the following illustration.

This development article discusses how to programmatically send an AEM email message that is based on a template. Furthermore, it also discusses how to populate the variables in the template with values. To send email messages that are based on AEM email templates, you use the MessageGatewayService API.

To read this development article, click https://helpx.adobe.com/experience-manager/using/htl_email_template.html.



By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.