Unable to send multiple file attachments in Email using servlet (REST endpoint)
Hello Community,
I was using the below code snippet provided by Adobe for getting multiple file attachments and sending an email using Email Service provided by ACS Commons:
https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/forms/adaptive-forms-authoring/authoring-adaptive-forms-foundation-components/configure-submit-actions-and-metadata-submission/custom-submit-action-form.html?lang=en#file-attachments
| Map<String, DataSource> attachments = new HashMap<>(); for (Map.Entry<String, RequestParameter[]> param : req.getRequestParameterMap().entrySet()) { RequestParameter rpm = param.getValue()[0]; logger.info("Param: {}", rpm); if(!rpm.isFormField()) { logger.info("Attachment found, content-type: {}", rpm.getContentType()); dataSource = new ByteArrayDataSource(rpm.get(), rpm.getContentType()); logger.info("Attachment: {}", rpm.getFileName()); // Create DataSource Map to attach all required set of files attachments.put(rpm.getFileName(), dataSource); } else { logger.info("No attachment found!"); } } |
NOTE: Multiple attachments option is checked in Adaptive Form.
However, when I upload multiple attachments, I receive only a single document in the email received.
Checked logs - enters the if loop only once even though we upload multiple files.
Any idea what might be wrong?