Self signed certificate
See original GitHub issueWhenever I try to connect to Google’s IMAP it fails due to a self-signed certificate
[DEBUG][2020-03-08T15:37:16.582Z][1][taitor46][imap.gmail.com] Connecting to imap.gmail.com : 993 [DEBUG][2020-03-08T15:37:16.587Z][1][taitor46][imap.gmail.com] Entering state: 1 (node:38836) UnhandledPromiseRejectionWarning: Error: Could not open socket: self signed certificate at TCPSocket.socket.onerror (/Users/tutorspace/Workspace/emailtest/node_modules/emailjs-imap-client/dist/imap.js:161:16) at TCPSocket._emit (/Users/tutorspace/Workspace/emailtest/node_modules/emailjs-tcp-socket/dist/node-socket.js:100:32) at TLSSocket.<anonymous> (/Users/tutorspace/Workspace/emailtest/node_modules/emailjs-tcp-socket/dist/node-socket.js:74:18) at TLSSocket.emit (events.js:311:20) at emitErrorNT (internal/streams/destroy.js:92:8) at emitErrorAndCloseNT (internal/streams/destroy.js:60:3) at processTicksAndRejections (internal/process/task_queues.js:84:21)
I had a similar issue when using imap-simple
and it seems that we had to specify the host name.
tlsOptions: { servername: 'imap.gmail.com' }
Such option doesn’t seem to exist here (at least I couldn’t find it). Can you please check it? Testing with a gmail account is very straight away.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7 (1 by maintainers)
Top GitHub Comments
@ctobtb If you need a fast and rough solution, that may help:
process.env.NODE_TLS_REJECT_UNAUTHORIZED='0';
@cecilcosta Take a look at this: https://github.com/nodejs/node/issues/28167