From 29d38ff43df2f3a8fae4d341e26b157f8b26524a Mon Sep 17 00:00:00 2001 From: Junyan Li Date: Tue, 16 Aug 2022 21:32:00 -0400 Subject: [PATCH 1/2] Update Connection.js --- lib/Connection.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Connection.js b/lib/Connection.js index bd31e98b..0d06c77b 100644 --- a/lib/Connection.js +++ b/lib/Connection.js @@ -60,6 +60,7 @@ function Connection(config) { socket: config.socket, socketTimeout: config.socketTimeout || 0, host: config.host || 'localhost', + servername: config.servername || 'localhost', port: config.port || 143, tls: config.tls, tlsOptions: config.tlsOptions, @@ -118,7 +119,7 @@ Connection.prototype.connect = function() { if (config.tls) { tlsOptions = {}; // servername must be set to prevent issues with some imap server and openssl 1.1.1 - tlsOptions.servername = config.host; + tlsOptions.servername = config.servername || config.host tlsOptions.host = config.host; // Host name may be overridden the tlsOptions for (var k in config.tlsOptions) From d80d1688a8ead90b9f52ef754503a9af45b705ae Mon Sep 17 00:00:00 2001 From: Junyan Li Date: Tue, 16 Aug 2022 22:33:03 -0400 Subject: [PATCH 2/2] fix issue when servername not match host. when enable tls. there is a certificate error --- lib/Connection.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Connection.js b/lib/Connection.js index 0d06c77b..c7a88112 100644 --- a/lib/Connection.js +++ b/lib/Connection.js @@ -60,7 +60,7 @@ function Connection(config) { socket: config.socket, socketTimeout: config.socketTimeout || 0, host: config.host || 'localhost', - servername: config.servername || 'localhost', + servername: config.servername, port: config.port || 143, tls: config.tls, tlsOptions: config.tlsOptions,