}
}
SiteDomainParamBean siteDomainParamBean = SiteDomainDAO.getSiteDomainParamBean(contentBean.getContentSessionBean().getSiteDomain().getSiteDomainLanguage(), siteDomainLanguage);
Site site = siteDomain.getSite();
TemplateEngine engine = TemplateEngine.getInstance();
engine.init(request, servletContext, true);
engine.setParameter("orderHeaderId", orderHeader.getOrderHeaderId());
String body = engine.mergeData("mail/custSaleConfirmation.vm", "template", engine);
Mailer mailer = new Mailer(site);
String mailFrom = siteDomainParamBean.getMailFromCustSales();
String subject = siteDomainParamBean.getSubjectCustSales();
String mailTo = orderHeader.getCustEmail();
if (mailFrom == null) {
mailFrom = "";
}
if (subject == null) {
subject = "";
}
if (Format.isNullOrEmpty(mailFrom) || Format.isNullOrEmpty(mailTo)) {
logger.error("Unable to send customer sales email");
logger.error("mailFrom = " + mailFrom);
logger.error("mailTo = " + mailTo);
logger.error("subject = " + subject);
}
mailer.sendMail(mailFrom, mailTo, subject, body, "text/html");
body = engine.mergeData("mail/adminSaleNotification.vm", "template", engine);
mailTo = siteDomainParamBean.getCheckoutNotificationEmail();
mailFrom = siteDomainParamBean.getMailFromNotification();
subject = siteDomainParamBean.getSubjectNotification();
if (!Format.isNullOrEmpty(mailFrom) && !Format.isNullOrEmpty(mailTo)) {
mailer.sendMail(mailFrom, mailTo, subject, body, "text/html");