GithubHelp home page GithubHelp logo

Comments (6)

felixhammerl avatar felixhammerl commented on July 20, 2024 2

I've worked around it by doing this:
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";

DO NOT DO THIS!
If you have a custom domain, please use proper certificates via letsencrypt. If this is for testing, please generate a trusted certificate via mkcert!

from emailjs-imap-client.

WhatFreshHellIsThis avatar WhatFreshHellIsThis commented on July 20, 2024 1

Dug into the code, this is not actually related to this repository, it's coming from the node socket library.

Looks like there is some confusion with the cert we are using, it's accepted by other code and libraries on other platforms and clients, just not by the node socket.

Since this is an internal facing only application I've worked around it by doing this:
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
Which temporarily overrides and allows it to work with our faulty cert.

This is entirely unsafe to do in most other circumstances, more info here: http://stackoverflow.com/questions/31673587/error-unable-to-verify-the-first-certificate-in-nodejs

from emailjs-imap-client.

WhatFreshHellIsThis avatar WhatFreshHellIsThis commented on July 20, 2024

Same here on NODE.JS connecting to our own remote mail server, porting code from C# to javascript, C# code and IMAP settings work fine with server but not in Javascript with this library.

Some kind of cert issue but not sure what it could be, the client doesn't need a cert or knowledge of the cert normally and the mail server works fine with C# code directly, also a variety of mail clients on a variety of platforms so it's something I'm doing or in this library, any help appreciated.

Here is my test code:

var HOST = "mail.REDACTED.com";
  var PORT = 993;
  var OPTIONS = {
      useSecureTransport: true,
      auth: {
          user: '[email protected]',
          pass: 'REDACTED'
      },
      id: { name: 'REDACTED', version: '1.x' }
  };

  var client = new ImapClient(HOST, PORT, OPTIONS);

  client.onerror = function (error) {
      return {
          error: 1,
          msg: 'Error @ key-requests->fetchRequests->onError (some kind of IMAP related error, see error_detail)',
          error_detail: error
      }

  }

  client.connect().then(() => {
      /* ready to roll */
      client.listMailboxes().then((mailboxes) => {
          //do something with mailboxes
          client.logout().then(() => {
              /* connection terminated */
              client.close().then(() => {
                  /* connection terminated */
                  callback({
                      test: 1,
                      ok: 1,
                      STUB_RESULT: 1
                  })
              });
          });
      })
  });

[DEBUG][2017-03-09T23:37:07.920Z][1] Connecting to mail.REDACTED.com : 993
[DEBUG][2017-03-09T23:37:07.924Z][1] Entering state: 1
[ERROR][2017-03-09T23:37:12.510Z][1] Could not connect to server Error: Could not open socket: unable to verify the first certificate
[DEBUG][2017-03-09T23:37:12.510Z][1] Entering state: 5
[DEBUG][2017-03-09T23:37:12.510Z][1] Closing connection...

from emailjs-imap-client.

simonhochrein avatar simonhochrein commented on July 20, 2024

Forgot about this thread, closing

from emailjs-imap-client.

aligatorr89 avatar aligatorr89 commented on July 20, 2024

Dug into the code, this is not actually related to this repository, it's coming from the node socket library.

Looks like there is some confusion with the cert we are using, it's accepted by other code and libraries on other platforms and clients, just not by the node socket.

Since this is an internal facing only application I've worked around it by doing this:
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
Which temporarily overrides and allows it to work with our faulty cert.

This is entirely unsafe to do in most other circumstances, more info here: http://stackoverflow.com/questions/31673587/error-unable-to-verify-the-first-certificate-in-nodejs

Great solution man, it works!!!

from emailjs-imap-client.

aligatorr89 avatar aligatorr89 commented on July 20, 2024

I've worked around it by doing this:
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";

DO NOT DO THIS!
If you have a custom domain, please use proper certificates via letsencrypt. If this is for testing, please generate a trusted certificate via mkcert!

Thanks, ill check it out. Like others, im having problems with IMAP connect. This problems started today out of nowhere, it worked for more than 2 weeks.

from emailjs-imap-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.