public void Send(string templateName, dynamic model) { string textLocation; if (Cohort.Site.Email.Templates.TryGetValue(templateName, out textLocation)) { textLocation = Cohort.Site.Email.BaseDirectory + textLocation; var htmlLocation = textLocation.Replace(".liquid", ".html.liquid"); var textTemplate = LoadOrGetCachedTemplate(textLocation); var htmlTemplate = LoadOrGetCachedTemplate(htmlLocation); var hasText = textTemplate != null; var hasHtml = htmlTemplate != null; EmailMessage email = null; if (hasText && hasHtml) { email = _composer.CreateCombinedEmail(htmlTemplate, textTemplate, model); } else if (hasText) { email = _composer.CreateTextEmail(textTemplate, model); } else if (hasHtml) { _composer.CreateHtmlEmail(htmlTemplate, model); } DeliverAndLog(email); } else { Logger.Warn("No email template named {0} found!"); } }
public EmailMessage CreateHtmlEmail(string htmlTemplate, dynamic model) { return(_composer.CreateHtmlEmail(htmlTemplate, model)); }