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

Avatar

Avatar

Phoenix_uy

Avatar

Phoenix_uy

Phoenix_uy

26-10-2015

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);

Accepted Solutions (0)

Answers (0)