How can I attach the report add-on generated reports to the email as attachments?
Hello,
You can generate a report in advance using the Reports API. Then, when sending the email, add the report as an attachment.
Example:
ReportOutputDocument document = reportRunner.byReportCode("reportCode")
.run();
EmailAttachment emailAtt = new EmailAttachment(document.getContent(), "Report.docx");
EmailInfo emailInfo = EmailInfoBuilder.create()
.setAddresses("john.doe@company.com,jane.roe@company.com")
.setSubject("Company news")
.setBody("Some content")
.setAttachments(emailAtt)
.build();
emailer.sendEmail(emailInfo);
Reports API - Running Reports :: Jmix Documentation
Email API - Email Sending API :: Jmix Documentation
Regards,
Nikita