email setup

This commit is contained in:
2026-02-23 23:55:26 +01:00
parent 6f9309cce8
commit 401d917a69
5 changed files with 263 additions and 9 deletions

View File

@@ -448,6 +448,15 @@ function fillSettingsForm(settings) {
: 0;
settingsForm.versions_retention.value = String(Math.max(0, retention));
}
if (settingsForm.smtp_enabled) settingsForm.smtp_enabled.checked = Number(settings.smtp_enabled) === 1;
if (settingsForm.smtp_host) settingsForm.smtp_host.value = settings.smtp_host || '';
if (settingsForm.smtp_port) settingsForm.smtp_port.value = settings.smtp_port ? String(settings.smtp_port) : '';
if (settingsForm.smtp_user) settingsForm.smtp_user.value = settings.smtp_user || '';
if (settingsForm.smtp_pass) settingsForm.smtp_pass.value = settings.smtp_pass || '';
if (settingsForm.smtp_secure) settingsForm.smtp_secure.value = settings.smtp_secure || '';
if (settingsForm.smtp_from_email) settingsForm.smtp_from_email.value = settings.smtp_from_email || '';
if (settingsForm.smtp_from_name) settingsForm.smtp_from_name.value = settings.smtp_from_name || '';
if (settingsForm.smtp_reply_to) settingsForm.smtp_reply_to.value = settings.smtp_reply_to || '';
refreshAdminTables(settings.bridge_setup?.tables || [], settings.bridge_tables || []);
}
@@ -501,6 +510,18 @@ async function submitSettingsForm(ev) {
const parsed = raw === '' ? 0 : Number(raw);
data.versions_retention = Number.isFinite(parsed) ? Math.max(0, Math.floor(parsed)) : 0;
}
if (settingsForm.smtp_enabled) data.smtp_enabled = settingsForm.smtp_enabled.checked ? 1 : 0;
if (settingsForm.smtp_host) data.smtp_host = settingsForm.smtp_host.value.trim();
if (settingsForm.smtp_port) {
const rawPort = settingsForm.smtp_port.value.trim();
data.smtp_port = rawPort === '' ? 0 : Number(rawPort);
}
if (settingsForm.smtp_user) data.smtp_user = settingsForm.smtp_user.value.trim();
if (settingsForm.smtp_pass) data.smtp_pass = settingsForm.smtp_pass.value;
if (settingsForm.smtp_secure) data.smtp_secure = settingsForm.smtp_secure.value;
if (settingsForm.smtp_from_email) data.smtp_from_email = settingsForm.smtp_from_email.value.trim();
if (settingsForm.smtp_from_name) data.smtp_from_name = settingsForm.smtp_from_name.value.trim();
if (settingsForm.smtp_reply_to) data.smtp_reply_to = settingsForm.smtp_reply_to.value.trim();
if (adminTablesAllSelect && adminTablesSelectedSelect) {
const bridgeTables = normalizeTableList(state.settings.bridge_tables || []);
data.bridge_tables = bridgeTables;