Nodemailer connection timeout error
Solution 1
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.
Solution 2
Have you looked at this answer.
It turns out that in order for Google to authorize a third party server to access your account via SMTP now, you have to enable “Less Secure Apps” on your gmail account, if you want to use username/password (more info here).
So you have two option:
use OAuth
make your account less secure
naik3
Updated on January 17, 2022Comments
-
naik3 over 2 years
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!' });