fix(EmailReadImap Node): Improve handling of network problems (#3406)

*  fix

*  tlsOptions fix
This commit is contained in:
Michael Kret 2022-07-10 12:16:02 +03:00 committed by GitHub
parent 732c8fcf84
commit 6f5809edb3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -433,10 +433,18 @@ export class EmailReadImap implements INodeType {
}, },
}; };
const tlsOptions: IDataObject = {};
if (options.allowUnauthorizedCerts === true) { if (options.allowUnauthorizedCerts === true) {
config.imap.tlsOptions = { tlsOptions.rejectUnauthorized = false;
rejectUnauthorized: false, }
};
if (credentials.secure) {
tlsOptions.servername = credentials.host as string;
}
if (!_.isEmpty(tlsOptions)) {
config.imap.tlsOptions = tlsOptions;
} }
// Connect to the IMAP server and open the mailbox // Connect to the IMAP server and open the mailbox
@ -456,9 +464,8 @@ export class EmailReadImap implements INodeType {
} }
} else { } else {
Logger.error('Email Read Imap node encountered a connection error', { error }); Logger.error('Email Read Imap node encountered a connection error', { error });
this.emitError(error);
} }
this.emitError(error);
}); });
return conn; return conn;
}); });