Exemple #1
0
        public ActionResult Setup()
        {
            EmailServerViewModel emailServer = new EmailServerViewModel();

            XmlDocument document = new XmlDocument();
            var         path     = AppDomain.CurrentDomain.BaseDirectory;

            document.Load(path + @"\config\mail.xml");
            emailServer.MailSendServer   = document.SelectSingleNode("/mailServer/mailSendServer").InnerText;
            emailServer.MailSendUser     = document.SelectSingleNode("/mailServer/mailSendUser").InnerText;
            emailServer.MailSendPassword = document.SelectSingleNode("/mailServer/mailSendPassword").InnerText;
            return(View(emailServer));
        }
Exemple #2
0
 public string Setup(EmailServerViewModel model)
 {
     if (ModelState.IsValid)
     {
         XmlDocument document = new XmlDocument();
         var         path     = AppDomain.CurrentDomain.BaseDirectory;
         document.Load(path + @"\config\mail.xml");
         document.SelectSingleNode("/mailServer/mailSendServer").InnerText   = model.MailSendServer;
         document.SelectSingleNode("/mailServer/mailSendUser").InnerText     = model.MailSendUser;
         document.SelectSingleNode("/mailServer/mailSendPassword").InnerText = model.MailSendPassword;
         document.Save(path + @"\config\mail.xml");
         return("成功");
     }
     else
     {
         return("失败");
     }
 }