Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nodemailer connection timeout error

I am using nodemailer module to send mail from my nodejs application. I am getting Error: connect ETIMEDOUT xxx.xxx.xx.xxx:465. Can any one help me in solving this. Here I am pasting my code.

var transporter = nodemailer.createTransport({
service: 'Gmail',
auth: {
    user: '[email protected]',
    pass: 'my_gmail_password'
}
});

console.log('created');
transporter.sendMail({
from: '[email protected]',
  to: '[email protected]',
  subject: 'hello world!',
  text: 'hello world!'
});
like image 623
naik3 Avatar asked Aug 17 '26 16:08

naik3


1 Answers

This may be firewall problem. I faced similar problem in Ubuntu (Digital Ocean server). Tried to fix the issue for 3 days, tried using auth2 also, tried with inactive firewall using ufw inactive command, but no luck. Finally I checked Digital Ocean admin panel and created firewall for the droplet. Problem solved by enabling TCP inbound and outbound in firewall settings.

like image 126
tiron Avatar answered Aug 19 '26 06:08

tiron



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!