加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 运营中心 > Nginx > 正文

node.js-无法从nodemailer发送电子邮件

发布时间:2020-12-13 20:56:23 所属栏目:Nginx 来源:网络整理
导读:嗨,我正在使用nodemailer发送电子邮件.我的nodejs应用程序通过Nginx反向代理部署在gcp实例上.我的代码能够在本地发送电子邮件,但不能从服务器发送电子邮件.请注意,还启用了ssl. 请注意,该命令不是从telnet smtp.1and1.com运行的587 但这正在运行telnet smtp.

嗨,我正在使用nodemailer发送电子邮件.我的nodejs应用程序通过Nginx反向代理部署在gcp实例上.我的代码能够在本地发送电子邮件,但不能从服务器发送电子邮件.请注意,还启用了ssl.

请注意,该命令不是从telnet smtp.1and1.com运行的587

但这正在运行telnet smtp.gmail.com 587

这是我的代码

var transporterOptions = {
host: "smtp.1and1.com",port: 587,auth: {
    user: email,pass: pass
},secure:true
};
最佳答案
Google已在实例级别屏蔽了端口587,因此您将无法使用该端口发送任何电子邮件.有关更多信息,请访问Sending Email from an Instance,其中显示:

Google Compute Engine does not allow outbound connections on ports 25,465,and 587. By default,these outbound SMTP ports are blocked because of the large amount of abuse these ports are susceptible to. In addition,having a trusted third-party provider such as SendGrid,Mailgun,or Mailjet relieves Compute Engine and you from maintaining IP reputation with your receivers.

但是,有一个逐步的安装指南叫Sending Email with SendGrid,您可以遵循.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读