I am trying to include the order invoice in a email template that im sending with code.
Template:
{% Order.OrderInvoice #%}
Code:
EmailTemplateInfo mEmailTemplate = EmailTemplateProvider.GetEmailTemplate("OrderPaidToCompany", OrderObject.OrderSiteID);
EmailMessage message = new EmailMessage();
message.EmailFormat = EmailFormatEnum.Default;
message.Recipients = CustomCartData.Company.ContactEmail;
MacroResolver Resolver = MacroResolver.GetInstance();
Resolver.SetNamedSourceData("Order", OrderObject);
Resolver.SetNamedSourceData("Company", CustomCartData.Company);
Resolver.SetNamedSourceData("CompanyRole", CustomCartData.CompanyRole);
try
{
// Send e-mail
EmailSender.SendEmailWithTemplateText(SiteInfoProvider.GetSiteName(OrderObject.OrderSiteID), message, mEmailTemplate, Resolver, false);
}
catch
{
// Email sending failed
EventLogProvider.LogEvent(EventType.ERROR, "SendOrderEmailToCompany", "Was Not able to send a copy of receipt to the company");
}
However when previewing the email in the Email Queue, the HTML is not rendering. Its just shows the html tags.
This same invoice (Order.OrderInvoice) is used in the order status update and order confirmation templates and it renders fine.
Thanks