public ActionResult _EditOutBox(SmtpSettingsEditModel model)
        {
            ViewData["NeedAutoCompletion"] = false;

            if (!ModelState.IsValid || !model.IsValidate)
            {
                ViewData["StatusMessageData"] = new StatusMessageData(StatusMessageType.Error, "数据验证失败,请检查数据是否填写完整");
                return View(model);
            }

            emailService.SaveSmtpSetting(model.AsSmtpSettings());
            return Json(new StatusMessageData(StatusMessageType.Success, "保存成功"));
        }
        public ActionResult _AutoCompletionSmtpSetting(SmtpSettingsEditModel model)
        {
            if (string.IsNullOrEmpty(model.UserEmailAddress) || model.UserEmailAddress.IndexOf("@") < 0)
                return Json(new StatusMessageData(StatusMessageType.Error, "请输入正确的邮箱之后,在继续尝试"));

            EmailServiceProvider emailProvider;
            string domainName = model.UserEmailAddress.Substring(model.UserEmailAddress.LastIndexOf('@') + 1);
            try
            {
                emailProvider = EmailServiceProviderService.Instance().GetEmailConfig()[domainName];

                string userName = model.UserEmailAddress.Substring(0, model.UserEmailAddress.LastIndexOf('@'));

                model.EnableSsl = emailProvider.SmtpSettings.EnableSsl;
                model.ForceSmtpUserAsFromAddress = emailProvider.SmtpSettings.ForceSmtpUserAsFromAddress;
                model.Host = emailProvider.SmtpSettings.Host;
                model.Port = emailProvider.SmtpSettings.Port;
                model.RequireCredentials = emailProvider.SmtpSettings.RequireCredentials;
                model.UserName = emailProvider.SmtpSettings.UserName.Replace("username", userName);
            }
            catch (KeyNotFoundException)
            {
                //return Json(new StatusMessageData(StatusMessageType.Error, "检测失败,请完善更多设置"));
                TempData["StatusMessageData"] = new StatusMessageData(StatusMessageType.Error, "检测失败,请手动设置更多选项");
            }

            TempData["SmtpSettingsEditModel"] = model;

            return _EditOutBox();
        }