Skip to content

Commit 510a1fb

Browse files
authored
Simplify logic again
This should make all of our problems go away really with this if statement. It checks if the TLS should actually be initiated rather than relying on vague messaging or a not very good check :)
1 parent a929dfb commit 510a1fb

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

sendmail.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ module.exports = function (options) {
160160
let parts;
161161
let cmd;
162162
let upgraded = false;
163-
let hellod = false;
164163

165164
/*
166165
if(mail.user && mail.pass){
@@ -184,7 +183,7 @@ module.exports = function (options) {
184183
case 220:
185184
//* 220 on server ready
186185
//* 220 服务就绪
187-
if(/\bGo ahead\b/i.test(msg) || /\bTLS\b/i.test(msg) || hellod){
186+
if(upgraded === "in-progress"){
188187
sock.removeAllListeners('data');
189188

190189
let original = sock;
@@ -234,7 +233,6 @@ module.exports = function (options) {
234233
cmd = 'HELO'
235234
}
236235
w(cmd + ' ' + srcHost);
237-
hellod = true;
238236
break;
239237
}
240238

@@ -246,6 +244,7 @@ module.exports = function (options) {
246244
if(upgraded != true){
247245
if(/\bSTARTTLS\b/i.test(msg)){
248246
w('STARTTLS');
247+
upgraded = "in-progress";
249248
} else {
250249
upgraded = true;
251250
}

0 commit comments

Comments
 (0)