public void sendEmailWithTemplate(String userName, String templateKey, Map<String, Object> properties) {
String subject = templateEJB.merge(Constante.PREFIX_EMAIL_TEMPLATE_SUBJECT + templateKey,
Locale.FRENCH, properties);
String body = templateEJB.merge(Constante.PREFIX_EMAIL_TEMPLATE_BODY + templateKey,
Locale.FRENCH, properties);
User user = userEJB.findUserByUserName(userName);
if (StringUtils.isBlank(subject) || StringUtils.isBlank(body) || user == null) {
throw new IllegalArgumentException("Template or User can not be found.");
} else {
sendMail(subject, body, user.getEmail());
}
}