fix email config

This commit is contained in:
Alex Holliday committed 2026-02-09 23:41:21 +00:00
1 parent 34762ef475
commit 1236b9191e
1 file changed
+17 -22
+17 -22
View File
@@ -65,28 +65,12 @@ const SettingsEmail = ({
* Handle sending test email with current form values * Handle sending test email with current form values
*/ */
const handleSendTestEmail = () => { const handleSendTestEmail = () => {
// Collect current form values
const emailConfig = {
systemEmailHost,
systemEmailPort,
systemEmailSecure,
systemEmailPool,
systemEmailUser,
systemEmailAddress,
systemEmailPassword: password || systemEmailPassword,
systemEmailTLSServername,
systemEmailConnectionHost,
systemEmailIgnoreTLS,
systemEmailRequireTLS,
systemEmailRejectUnauthorized,
};
// Basic validation // Basic validation
if ( if (
!emailConfig.systemEmailHost || !systemEmailHost ||
!emailConfig.systemEmailPort || !systemEmailPort ||
!emailConfig.systemEmailAddress || !systemEmailAddress ||
!emailConfig.systemEmailPassword !(password || systemEmailPassword)
) { ) {
createToast({ createToast({
body: t("settingsPage.emailSettings.toastEmailRequiredFieldsError"), body: t("settingsPage.emailSettings.toastEmailRequiredFieldsError"),
@@ -95,10 +79,21 @@ const SettingsEmail = ({
return; return;
} }
// Send test email with current form values // Send test email - only include optional fields if they have values
sendTestEmailFn("/settings/test-email", { sendTestEmailFn("/settings/test-email", {
to: user.email, to: user.email,
...emailConfig, systemEmailHost,
systemEmailPort,
systemEmailAddress,
systemEmailPassword: password || systemEmailPassword,
systemEmailSecure,
systemEmailPool,
systemEmailIgnoreTLS,
systemEmailRequireTLS,
systemEmailRejectUnauthorized,
...(systemEmailUser && { systemEmailUser }),
...(systemEmailTLSServername && { systemEmailTLSServername }),
...(systemEmailConnectionHost && { systemEmailConnectionHost }),
}); });
}; };