fix(email): test saved SMTP config and add TLS modes (#3388)

This commit is contained in:
Hampus authored and GitHub committed 2026-10-11 13:30:00 +02:00
1 parent 45b78a13c2
commit cca8227ca6
66 files changed
+2464 -319

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import type {ValueOf} from '@fluxer/constants/src/ValueOf';
export const SmtpTlsModes = {
IMPLICIT: 'implicit',
STARTTLS: 'starttls',
OPPORTUNISTIC: 'opportunistic',
NONE: 'none',
} as const;
export type SmtpTlsMode = ValueOf<typeof SmtpTlsModes>;
const SMTP_IMPLICIT_TLS_PORT = 465;
export function resolveSmtpTlsMode(mode: SmtpTlsMode | null | undefined, port: number): SmtpTlsMode {
if (mode) return mode;
return port === SMTP_IMPLICIT_TLS_PORT ? SmtpTlsModes.IMPLICIT : SmtpTlsModes.STARTTLS;
}
export function smtpTlsModeFromSecure(secure: boolean | null | undefined): SmtpTlsMode | null {
if (secure == null) return null;
return secure ? SmtpTlsModes.IMPLICIT : SmtpTlsModes.OPPORTUNISTIC;
}