Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp

fix(constants): use STARTTLS for secure SMTP on other ports

Hampus86378b6f0943
diff --git a/packages/constants/src/SmtpConstants.ts b/packages/constants/src/SmtpConstants.ts
index bd3ec14bf..c2d1fa997 100644
--- a/packages/constants/src/SmtpConstants.ts
+++ b/packages/constants/src/SmtpConstants.ts
@@ -18,7 +18,11 @@ export function resolveSmtpTlsMode(mode: SmtpTlsMode | null | undefined, port: n
return port === SMTP_IMPLICIT_TLS_PORT ? SmtpTlsModes.IMPLICIT : SmtpTlsModes.STARTTLS;
}
-export function smtpTlsModeFromSecure(secure: boolean | null | undefined): SmtpTlsMode | null {
+export function smtpTlsModeFromSecure(
+ secure: boolean | null | undefined,
+ port: number | null | undefined,
+): SmtpTlsMode | null {
if (secure == null) return null;
- return secure ? SmtpTlsModes.IMPLICIT : SmtpTlsModes.OPPORTUNISTIC;
+ if (!secure) return SmtpTlsModes.OPPORTUNISTIC;
+ return port == null || port === SMTP_IMPLICIT_TLS_PORT ? SmtpTlsModes.IMPLICIT : SmtpTlsModes.STARTTLS;
}