From bd402d2e89bcb88b1cabdcf3a59a206116a968f9 Mon Sep 17 00:00:00 2001 From: Luca <102960244+Luca-Timo@users.noreply.github.com> Date: Fri, 12 Jun 2026 14:39:09 +0200 Subject: [PATCH] fix(email): IMAP Security dropdown auto-fills the conventional port Selecting SSL/TLS sets port 993 and STARTTLS/none sets 143, so the port in the dropdown label is no longer just decoration. A non-standard custom port (anything other than 993/143/empty) is left untouched. --- .../components/admin/IncomingMailConfigCard.tsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/admin/IncomingMailConfigCard.tsx b/frontend/src/components/admin/IncomingMailConfigCard.tsx index 5cf2fe5f..1eb64883 100644 --- a/frontend/src/components/admin/IncomingMailConfigCard.tsx +++ b/frontend/src/components/admin/IncomingMailConfigCard.tsx @@ -30,6 +30,20 @@ export const IncomingMailConfigCard: React.FC = () => { const set = (k: keyof IncomingMailConfig, v: any) => setCfg((c) => ({ ...c, [k]: v })); + // Changing Security auto-fills the conventional IMAP port (SSL/TLS → 993, + // STARTTLS/none → 143) so the port in the dropdown label isn't just + // decoration. A non-standard custom port is left untouched. + const onSecurityChange = (val: string) => { + const secure = val === 'ssl'; + setCfg((c) => { + const next = { ...c, imap_secure: secure }; + if (!c.imap_port || c.imap_port === 993 || c.imap_port === 143) { + next.imap_port = secure ? 993 : 143; + } + return next; + }); + }; + const save = useMutation({ mutationFn: () => { // Mirror the SMTP card's client-side required guard. Host + port + @@ -91,7 +105,7 @@ export const IncomingMailConfigCard: React.FC = () => {