Expand my Community achievements bar.

Unable to send multiple file attachments in Email using servlet (REST endpoint)


Level 2

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:

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?


Topics help categorize Community content and increase your ability to discover relevant content.

5 Replies


Level 2

yes, on Cloud. 
Workflow is the only option to send multiple files?



not necessary to use workflow. The article I sent was for 6.5




@Rohan0794 Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.

Kautuk Sahni