sorry for my english
I am using nodemailer and when querying through the api it gives this 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'
}
My code:
this.transporter = nodemailer.createTransport({
service: 'gmail'
auth: {
user: mygmail@gmail.com,
pass: mypass,
},
})
UPD: I connected the phone to the Internet instead of my LAN cable, checked, everything worked. There was no error, I connected the LAN back, disconnected the phone, this error appeared again
Make sure that Less secure app access is on in your Gmail account:
Then fix your code:
this.transporter = nodemailer.createTransport({
service: "gmail",
auth: {
user: email,
pass: password
}
});
You can use the built-in service in the Nodemailer and make your code simpler with this one.
this.transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: mygmail@gmail.com,
pass: mypass,
},
})
Please make sure you have disabled 2-Step verification.