ctx.setVariable("requesterDeviceType", domainRequest.getDeviceType());
ctx.setVariable("requesterRegion", domainRequest.getRegion());
List<Language> languages = new ArrayList<Language>();
languages.addAll(domainRequest.getLanguages());
Collections.sort(languages, new LanguageComparator());
ctx.setVariable("requesterLanguages", languages);
applyBranding(domainRequest.getDomain(), ctx);
// Create the HTML body using Thymeleaf
final String htmlContent = this.templateEngine.process("email-domainAccessRequestTH", ctx);
message.setText(htmlContent, true /* isHtml */);
message.setTo(email);
if (sendMessage(mimeMessage)) {
numberOfEmails += 1;
}
}
} else {
List<User> users = domainService.getAllAdmins(domainRequest.getDomain(), true);
emailCount = (users == null ? 0 : users.size());
if (users != null) {
for (User user : users) {
Context ctx = new Context(locale);
ctx.setVariable("url", webRequest.generateURL("/manager/requestsPending/" + domainRequest.getDomain().getId()));
ctx.setVariable("domain", domainRequest.getDomain());
ctx.setVariable("requesterFirstName", domainRequest.getFirstName());
ctx.setVariable("requesterLastName", domainRequest.getLastName());
ctx.setVariable("requesterEmail", domainRequest.getEmailAddress());
ctx.setVariable("requesterAddress", domainRequest.getAddress());
ctx.setVariable("requesterCompanyName", domainRequest.getCompanyName());
ctx.setVariable("requesterPhone", domainRequest.getPhoneNumber());
ctx.setVariable("requesterDeviceType", domainRequest.getDeviceType());
ctx.setVariable("requesterRegion", domainRequest.getRegion());
List<Language> languages = new ArrayList<Language>();
languages.addAll(domainRequest.getLanguages());
Collections.sort(languages, new LanguageComparator());
ctx.setVariable("requesterLanguages", languages);
ctx.setVariable("user", user);
// Create the HTML body using Thymeleaf