ACS commons sends mail to multiple recipients separately causing duplicate emails
I'm using ACS commons to send mail like this. the EmailService is from ACS commons. Problem here is the service sends the mail to each recepient in toEmail separately while also having ccemail and bccrecpient in it. This causes mail to be tiggered to the ccemail and bccrecepient multiple times which is causing an issue since the bccrecepient triggers a request number in the backend and they are getting three different emails for the same request. Is there any way to send the email once to multiple recipients?
Map<String, String> emailParams = new HashMap<>();
emailParams.put("subject", subject);
emailParams.put("ccEmail", ccEmail);
emailParams.put("bccrecipient", bccEmail);
emailParams.put("body", bodyText.toString());
Map<String, DataSource> attachments = new HashMap<>();
if (!(fileName.isEmpty() || excelString.isBlank())) {
try {
attachments.put(fileName, new ByteArrayDataSource(excelString, "text/plain"));
} catch (IOException e) {
log.info("Exception {} creating attachment", e);
}
}
List<String> failureList = emailService.sendEmail("/etc/notification/email/email-template.txt", emailParams, attachments, toEmail.split(","));