From e0c35d34bed432ca1bff79e7d9c57b9bd6ff5c65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kr=C3=BCger?= <2pi_r2@gmx.de> Date: Tue, 29 Nov 2022 16:37:46 +0100 Subject: [PATCH] fix: before starttls check if connection is secure (#57) --- client/basic/client.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/basic/client.ts b/client/basic/client.ts index 4ad5f17..23b8b0a 100644 --- a/client/basic/client.ts +++ b/client/basic/client.ts @@ -326,7 +326,12 @@ export class SMTPClient { } if ( - this.#supportedFeatures.has("STARTTLS") && !this.config.debug.noStartTLS + // When in TLS don't use STARTTLS + !this.secure && + // Check for STARTTLS support + this.#supportedFeatures.has("STARTTLS") && + // Check that STARTTLS is allowed + !this.config.debug.noStartTLS ) { this.#connection.writeCmdAndAssert(CommandCode.READY, "STARTTLS");