I have using nodemailer to send emial notification in my system, and it works perfect before this week. I got an error said cannot use IPV4 address with current network
{ Error: Can not use IPv4 addresses with current network
at GetAddrInfoReqWrap.dns.lookup [as callback] (/home/****/backend/node_modules/nodemailer/lib/shared/index.js:203:35)
at GetAddrInfoReqWrap.onlookupall [as oncomplete] (dns.js:80:8) code: 'EDNS', command: 'CONN' }
Some info related to my system and application:
System: Ubuntu 22.04.
Backend: express.js.
Node.js version: 10.19.0.
const nodemailer = require('nodemailer');
const transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: '**',
pass: '**',
},
});
function sendEmail(to, subject, text, html) {
transporter.sendMail({
from: '"Server - donotreply" <mailto:*******@gmail.com>', // sender address
to: to, // list of receivers
subject: subject, // Subject line
text: text, // plain text body
html: html, // html body
}).then(info =\> {
console.log({info});
}).catch(console.error);
}
I have no idea what is going on, can anyone please provide some info that can helps me figure out. thanks a lot
i have ried to restart the application and reboot the system, but the problem still exist.
CodePudding user response:
I haven't found answer for the problem, but i found a posible solusion to solve it.
Try reinstall the nodemailer - use npm install all
It works for me