use of com.haulmont.cuba.core.global.EmailInfo in project cuba by cuba-platform.
the class ExceptionReportServiceBean method sendExceptionReport.
@Override
public void sendExceptionReport(String supportEmail, Map<String, Object> binding) {
try {
Map<String, Object> map = new HashMap<>(binding);
User user = userSessionSource.getUserSession().getUser();
map.put("user", user);
map.put("toHtml", new MethodClosure(HtmlUtils.class, "convertToHtml"));
String body = getExceptionReportBody(map);
String subject = getExceptionReportSubject(map);
EmailInfo info = EmailInfoBuilder.create().setAddresses(supportEmail).setCaption(subject).setBody(body).build();
emailer.sendEmail(info);
} catch (Exception e) {
log.error("Error sending exception report", e);
throw new RuntimeException("Error sending exception report");
}
}
use of com.haulmont.cuba.core.global.EmailInfo in project cuba by cuba-platform.
the class EmailServiceBean method sendEmail.
@Override
public void sendEmail(String address, String caption, String body, String bodyContentType, EmailAttachment... attachment) throws EmailException {
EmailInfo emailInfo = EmailInfoBuilder.create(address, caption, body).setBodyContentType(bodyContentType).setAttachments(attachment).build();
emailer.sendEmail(emailInfo);
}
Aggregations