diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/SystemRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/SystemRepository.java index 00c52666309..598049453b2 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/SystemRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/SystemRepository.java @@ -141,6 +141,21 @@ public class SystemRepository { @Transaction public Response createOrUpdate(Settings setting) { Settings oldValue = getConfigWithKey(setting.getConfigType().toString()); + + if (oldValue != null && oldValue.getConfigType().equals(SettingsType.EMAIL_CONFIGURATION)) { + SmtpSettings configValue = + JsonUtils.convertValue(oldValue.getConfigValue(), SmtpSettings.class); + if (configValue != null) { + SmtpSettings.Templates templates = configValue.getTemplates(); + SmtpSettings newConfigValue = + JsonUtils.convertValue(setting.getConfigValue(), SmtpSettings.class); + if (newConfigValue != null) { + newConfigValue.setTemplates(templates); + setting.setConfigValue(newConfigValue); + } + } + } + try { updateSetting(setting); } catch (Exception ex) {