Error: self-signed certificate Nodejs Pop3 While trying to read email from google

195 views Asked by At

I am trying to build a sistem that looks for my security camera's emails and turn lights on and off in the house with the smartthing API, but when I run the basic example code just to get the emails I get the error that I have a self signed certificate.

My code

var POP3Client = require("mailpop3");
var client = new POP3Client(995, "pop.gmail.com", {
  tlserrs: false,
  enabletls: true,
  debug: false,
});

client.on("error", function (err) {
  if (err.errno === 111) console.log("Unable to connect to server");
  else console.log("Server error occurred");
  console.log(err);
});

client.on("connect", function () {
  console.log("CONNECT success");
  client.login("email", "pas");
});

I've tried like 10 youtube videos made by some indian guy and even chat-gpt but all of them didn't work...

Server error occurred

Error: self-signed certificate at TLSSocket.onConnectSecure (node:_tls_wrap:1540:34) at TLSSocket.emit (node:events:513:28) at TLSSocket._finishInit (node:_tls_wrap:959:8) at ssl.onhandshakedone (node:_tls_wrap:743:12) { code: 'DEPTH_ZERO_SELF_SIGNED_CERT' }

0

There are 0 answers