Error: self-signed certificate in certificate chain

44 views Asked by At

This error happened so I could not fixed. I should get an email but it did not send an email.

Error: self-signed certificate in certificate chain at TLSSocket.onConnectSecure (node:_tls_wrap:1674:34) at TLSSocket.emit (node:events:518:28) at TLSSocket._finishInit (node:_tls_wrap:1085:8) at ssl.onhandshakedone (node:_tls_wrap:871:12) { code: 'ESOCKET', command: 'CONN' }

const transporter = nodemailer.createTransport({
    host: 'smtp.gmail.com',
    port: 465,
    secure: true,
    auth: {
      user: process.env.MAIL_ID,
      pass: process.env.MP,
    },
  });
  const info = await transporter.sendMail({
    from: '" Hey " <[email protected]>',
    to: data.to,
    subject: data.subject,
    text: data.text,
    html: data.htm,
  });

  console.log('Message sent: %s', info.messageId);
  console.log('Preview URl: %s', nodemailer.getTestMessageUrl(info));
});

module.exports = sendEmail;
0

There are 0 answers