Home>

I've been trying to fix one problem for the 3rd day. I use nodemailer to send a message to the mail, but it gives the same error all the time. Everything in gmail is set up. The funny thing is that a couple of weeks ago I did the same thing and everything worked. Here is the error:

Error: queryA EREFUSED smtp.gmail.com
    at QueryReqWrap.onresolve [as oncomplete] (dns.js: 210: 19) {
  errno: undefined,
  code: 'EDNS',
  syscall: 'queryA',
  hostname: 'smtp.gmail.com',
  command: 'CONN'
}

Here's the code:

this.transporter= nodemailer.createTransport ({
      host: process.env.SMTP_HOST,
      port: process.env.SMTP_PORT,
      secure: false,
      auth: {
        user: process.env.SMTP_USER,
        pass: process.env.SMTP_PASSWORD,
      },
    })

The data itself from .env:

SMTP_HOST= "smtp.gmail.com"
SMTP_PORT= 587
SMTP_USER='[email protected] '
SMTP_PASSWORD= 'mypass'

1. Try a different port for google 2. Make sure that you have enabled access for third-party applications in gmail itself 3. And in my mind google uses SSL although you have written secure: false (if this field is responsible for something else, sorry did not know (did not work earlier with this module "

pyduti2021-11-02 13:26:55

I already used port 465, and set secure: true, and combined all this. Nothing helped. Third party app access enabled

zflexz2021-11-02 13:40:04

Have you tried from another IP address /provider?

Anatoly2021-11-02 16:38:15