Nodemailer 连接超时错误 [英] Nodemailer connection timeout error

查看:81
本文介绍了Nodemailer 连接超时错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 nodemailer 模块从我的 nodejs 应用程序发送邮件.我收到错误:连接 ETIMEDOUT xxx.xxx.xx.xxx:465.任何人都可以帮助我解决这个问题.我在这里粘贴我的代码.

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: 'my_mail_id@gmail.com',
    pass: 'my_gmail_password'
}
});

console.log('created');
transporter.sendMail({
from: 'my_mail_id@gmail.com',
  to: 'my_mail_id@gmail.com',
  subject: 'hello world!',
  text: 'hello world!'
});

推荐答案

这可能是防火墙问题.我在 Ubuntu(数字海洋服务器)中遇到了类似的问题.试图解决这个问题 3 天,也尝试使用 auth2,尝试使用 ufw inactive 命令使用非活动防火墙,但没有运气.最后,我检查了 Digital Ocean 管理面板并为 Droplet 创建了防火墙.通过在防火墙设置中启用 TCP 入站和出站解决了问题.

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.

这篇关于Nodemailer 连接超时错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆