public vStoreEmailTemplate GetStoreEmailTemplate(EmailTemplateNames templateName) { vStoreEmailTemplateQuery q = new vStoreEmailTemplateQuery(); q.es.Top = 1; q.Where(q.StoreId == this.Id, q.NameKey == templateName.ToString()); vStoreEmailTemplate template = new vStoreEmailTemplate(); if (template.Load(q)) { return(template); } return(null); }
public string SendEmailTemplate(EmailTemplateNames templateName, Dictionary <string, string> tokens, string sendToEmail, DataModel.Store store) { //string storeEmail = storeContext.CurrentStore.GetSetting(StoreSettingNames.OrderCompletedEmailRecipient); string storeEmail = store.GetSetting(StoreSettingNames.OrderCompletedEmailRecipient); string customerServiceEmail = store.GetSetting(StoreSettingNames.CustomerServiceEmailAddress); string hostEmail = HostSettings.GetHostSetting("HostEmail"); string from = !string.IsNullOrEmpty(customerServiceEmail) ? customerServiceEmail : hostEmail; vStoreEmailTemplate emailTemplate = store.GetStoreEmailTemplate(templateName); string subject = tokenizer.ReplaceTokensInString(HttpUtility.HtmlDecode(emailTemplate.SubjectTemplate), tokens); string body = tokenizer.ReplaceTokensInString(HttpUtility.HtmlDecode(emailTemplate.BodyTemplate), tokens); body = InjectEmailCssIntoBody(body); return(SendEmail(from, sendToEmail, subject, body, true)); }