@Override
protected void prepareMessage(MimeMessageHelper helper,
Map<Object, Object> context) throws TemplateException, IOException, MessagingException {
Long messageId = (Long) context.get("messageId");
Message message = messageService.getMessage(messageId);
context.put("message", message);
context.put("site", message.getFrom().getCategory().getSite());
//
String subject = FreeMarkerTemplateUtils.processTemplateIntoString(
configuration.getTemplate(TEMPLATE_MESSAGE_CREATE_SUBJECT), context);
String content = FreeMarkerTemplateUtils.processTemplateIntoString(
configuration.getTemplate(TEMPLATE_MESSAGE_CREATE_CONTENT), context);
helper.setSubject(subject);
helper.setText(content, true);
helper.addTo(message.getTo().getEnteredBy().getEmail(),
message.getTo().getEnteredBy().getNickname());
}