Locale locale = LocaleContextHolder.getLocale();
message.setFrom(fromAddress);
if (user != null && !user.isActivated()) {
Context ctx = new Context(locale);
ctx.setVariable("name", user.getFullName());
ctx.setVariable("activationCode", user.getActivationCode());
ctx.setVariable("organizationName", organizationName);
String servletPath = "/activate/" + user.getActivationCode();
ctx.setVariable("url", request.generateURL(servletPath));
applyBranding(organization, ctx);
// Create the HTML body using Thymeleaf
final String htmlContent = this.templateEngine.process("email-accountActivationTH", ctx);
message.setText(htmlContent, true /* isHtml */);