public void processEmail(String templateName, Map dataModel, String recipient, final Properties mailProperties, boolean sendHtml)
throws IOException, TemplateException, MessagingException {
refreshTemplates();
String body = processTemplate(templateName, dataModel);
String subject = processTemplate(templateName + getSubjectSuffix(), dataModel);
ProcessToolNotificationTemplate template = templateMap.get(templateName);
Session mailSession = Session.getDefaultInstance(mailProperties, new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(mailProperties.getProperty("mail.smtp.user"), mailProperties.getProperty("mail.smtp.password"));
}
});
sendEmail(recipient, template.getSender(), subject, body, sendHtml, mailSession);
}