Esempio n. 1
0
        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());
            }
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }