Learn to create a custom form component which takes user input and on submit would send an email with an attached pdf which would contain the data entered in the form.
Understand how to create a custom component in AEM.
Understand how to create a custom Sling Servlet which would send an email.
Understand how to create a custom email.
Understand how to do the OSGI configurations for Mail Service.
Understand how to use pdfbox API to create a Pdf in the DAM Structure.
What you will build
A custom form component will be built taking user input in the form field. A Sling Servlet will be built which would be creating a pdf in the content DAM Structure and attaching the same pdf to the custom email.
Eclipse/ IntelliJ or any IDE
AEM Author Instance
SMTP Email Server
Define the Custom Form Component
- Create a component under /apps//components.
- sample_form is the component.
- Create the node cq:dialog and file sample_form.html under the component.
- Add the below code in the sample_form.html.
- Now, open wknd repo in any of the IDE and create a Servlet under wknd.core package.
- For the Servlet code, you can refer to the following URL :