I have a form with the submit action set to "Send email" and the email template path set to a .txt file under /libs/fd/dashboard/templates/email. The email is always sent with the content type text/plain instead of text/html. For the contents of the template, I have tried multiple things: copying that of htmlEmailTemplate.txt, editing that to include only a simple test <div>, replacing everything with a full HTML page (starting with DOCTYPE), etcetera. I'm using AEM 6.5.13.
Solved! Go to Solution.
Views
Replies
Total Likes
I ended up creating a workflow to send the email, and put the template under /apps/mysite instead of under /libs. For the form's submit action, select "Invoke an AEM workflow".
For the workflow:
- Add a variable "dataxml" of type XML, plus String variables for placeholders in the template.
- Add the Set Variables step. Map dataxml using the "Relative to payload" method to value "Data.xml", plus any other variables (I used the "Literal" method for all of the others).
- Add the Send Email step (from Forms workflows). Under Email Details, set the path to the template, then map the template placeholders to the variables.
Views
Replies
Total Likes
Hi @wizard04wsu,
Adobe CQ Form Mail Servlet handles the Mail Action type of Form Container (see implementation in the com.day.cq.wcm.foundation.forms.impl.MailServlet).
Based on its implementation, it can send 2 types of emails:
To send an HTML email, you need to use org.apache.commons.mail.HtmlEmail.
There is a good AEM Email API provided by ACS Commons: https://adobe-consulting-services.github.io/acs-aem-commons/features/e-mail/email-api/index.html. It allows you to use different email templates persisted in the repository, to send attachments etc.
I see 2 options for you:
I would suggest implementing option 1 because it won't affect OOTB code and will work separately.
Views
Replies
Total Likes
I will give that a try! Thank you for the guidance.
Views
Replies
Total Likes
Will you able to achieve this? I want to beatify the url in email template and to achieve this I overlayed in conf and added a div but then it is giving null null in email
Views
Replies
Total Likes
I ended up creating a workflow to send the email, and put the template under /apps/mysite instead of under /libs. For the form's submit action, select "Invoke an AEM workflow".
For the workflow:
- Add a variable "dataxml" of type XML, plus String variables for placeholders in the template.
- Add the Set Variables step. Map dataxml using the "Relative to payload" method to value "Data.xml", plus any other variables (I used the "Literal" method for all of the others).
- Add the Send Email step (from Forms workflows). Under Email Details, set the path to the template, then map the template placeholders to the variables.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies