Skip to content

Commit

Permalink
fix(EmailReadImap Node): Improve handling of network problems (#3406)
Browse files Browse the repository at this point in the history
* ⚡ fix

* ⚡ tlsOptions fix
  • Loading branch information
michael-radency committed Jul 10, 2022
1 parent 732c8fc commit 6f5809e
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions packages/nodes-base/nodes/EmailReadImap/EmailReadImap.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,10 +433,18 @@ export class EmailReadImap implements INodeType {
},
};

const tlsOptions: IDataObject = {};

if (options.allowUnauthorizedCerts === true) {
config.imap.tlsOptions = {
rejectUnauthorized: false,
};
tlsOptions.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
Expand All @@ -456,9 +464,8 @@ export class EmailReadImap implements INodeType {
}
} else {
Logger.error('Email Read Imap node encountered a connection error', { error });
this.emitError(error);
}

this.emitError(error);
});
return conn;
});
Expand Down

0 comments on commit 6f5809e

Please sign in to comment.