public async Task ChangeSmtpOptionAsync(ChangeSmtpOptionModel model) { var config = _configurationManager.ParseCurrent(); var smtpOption = _configurationRoot.Parse <SmtpOption>(nameof(SmtpOption)); smtpOption.UserName = model.UserName; config[nameof(SmtpOption)] = JToken.FromObject(smtpOption); _configurationManager.SaveConfig(config); await _secretsManager.SetAsync(ConfigConsts.Mail.PasswordKey, model.Password); }