0 Replies Latest reply on Oct 26, 2015 6:39 AM by Phoenix_uy

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

    Phoenix_uy Level 1

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