Hello,
I’m trying to set cc and bcc EmailInfo parameters to send an e-mail, but it doesn’t work, cc and bcc are ignored. It works for To, and for multiple recipients in To separated by semicolon.
During the debug session I can see that emailInfo has been properly set before emailService.sendEmail is called.
This is the code in question(HashMap<String, Serializable> templateParameters is built prior to this )
InputDialog emailDialog = dialogs.createInputDialog(this)
.withCaption("Send this via e-mail")
.withParameters(
InputParameter.stringParameter("subject")
.withCaption("Subject:").withRequired(true).withDefaultValue("Case: " + test1Str + " " + test2Str),
InputParameter.stringParameter("to")
.withCaption("To:").withRequired(true).withDefaultValue(email4report),
InputParameter.stringParameter("cc")
.withCaption("CC:"),
InputParameter.stringParameter("bcc")
.withCaption("BCC:")
)
.withActions(DialogActions.OK_CANCEL)
.withCloseListener(closeEvent -> {
if (closeEvent.closedWith(DialogOutcome.OK)) {
String subject = closeEvent.getValue("subject");
String to = closeEvent.getValue("to");
String cc = closeEvent.getValue("cc");
String bcc = closeEvent.getValue("bcc");
EmailInfo emailInfo = EmailInfoBuilder.create()
.setCaption(subject)
.setAddresses(to)
.setCc(cc)
.setBcc(bcc)
.setFrom(email4report)
.setTemplatePath("com/company/test1/templates/template1.txt")
.setTemplateParameters(templateParameters)
.build();
try {
emailService.sendEmail(emailInfo);
} catch (EmailException e) {
e.printStackTrace();
}
}
})
.show();
}
There seems to have been youtrack case How to specify CC and BCC email addresses to EmailInfo
Can anyone send cc and bcc with success?
Thanks
Mladen