Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Get file attachment path to use in JSP to send email with attachment?

Phoenix_uy
Level 2
Level 2

I'm kind new in AEM and Adaptive Forms and i'm making a custom action for a form. 

My problem is that i don't know how to get the information from a file attachment component to use in my JSP code to send an email.

This is part of the code that i have right now:

    

ValueMap props = ResourceUtil.getValueMap(resource); HtmlEmail email = new HtmlEmail(); String[] mailTo = props.get("mailto", new String[0]); email.setFrom((String)props.get("from")); for (String toAddr : mailTo) { email.addTo(toAddr); } //EmailAttachment attachment = new EmailAttachment(); //What do i need to do from here to set the attachment? email.setHtmlMsg((String)props.get("template")); email.setSubject((String)props.get("subject")); MessageGatewayService messageGatewayService = sling.getService(MessageGatewayService.class); MessageGateway messageGateway = messageGatewayService.getGateway(HtmlEmail.class); messageGateway.send(email);
0 Replies