private static string ReadTemplate(EMailTemplateType templateType) { HttpContext httpcontext = HttpContext.Current; string templatePath = GetTemplatePath(templateType); using (StreamReader reader = new StreamReader(httpcontext.Server.MapPath(templatePath))) { return(reader.ReadToEnd()); } }
private static string BindTemplate(EMailTemplateType templateType, Dictionary <string, string> valueList) { string emailBody = LoadContent(GetTemplatePath(templateType)); //string emailBody = ReadTemplate(templateType); foreach (var item in valueList) { emailBody = emailBody.Replace(item.Key, item.Value); } return(emailBody); }
private static string GetTemplatePath(EMailTemplateType templateType) { string filePath = ""; switch (templateType) { case EMailTemplateType.Scheduled_Message: filePath = "EmailTemplates/ScheduledMessage.html"; break; case EMailTemplateType.Subscription_Message: filePath = "EmailTemplates/SubscriptionMessage.html"; break; } return(filePath); }