Ejemplo n.º 1
0
        public static string GetEmailMessage(SendEmailType emailType, Dictionary <string, string> placeHolders)
        {
            var emailTypeConfig = EmailConfig.ReadConfiguration().EmailTypes.FirstOrDefault(m => m.Name == emailType.ToString());

            string mailbody = string.Empty;

            using (StreamReader reader = new StreamReader(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, emailTypeConfig.HtmlContentFile)))
            {
                mailbody = reader.ReadToEnd();
            }
            return(ReplaceMessagePlaceHolders(mailbody, placeHolders));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取Email格式XML的节点
        /// </summary>
        /// <param name="ToUse">用途标记,ToUse节点内容</param>
        /// <returns></returns>
        public static XmlConfig_Email GetEmailConfig(SendEmailType toUse)
        {
            string   filename   = GetMapPath(EMAIL_PATH);
            XElement xml        = XElement.Load(filename);
            XElement configNode = xml.Elements("MailConfig").First(z => z.Element("ToUse").Value == toUse.ToString());

            return(new XmlConfig_Email()
            {
                ToUse = configNode.Element("ToUse").Value,
                Subject = configNode.Element("Subject").Value,
                Body = configNode.Element("Body").Value,
                Holders = configNode.Element("Holders").Value,
                UpdateTime = DateTime.Parse(configNode.Element("UpdateTime").Value)
            });
        }
Ejemplo n.º 3
0
        public static string GetEmailSubject(SendEmailType emailType, Dictionary <string, string> placeHolders)
        {
            var emailTypeConfig = EmailConfig.ReadConfiguration().EmailTypes.FirstOrDefault(m => m.Name == emailType.ToString());

            return(ReplaceMessagePlaceHolders(emailTypeConfig.Subject, placeHolders));
        }