gpt4 book ai didi

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

转载 作者:搜寻专家 更新时间:2023-10-31 23:45:03 24 4
gpt4 key购买 nike

您好,我正在使用 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 的分步设置指南。您可以关注。

关于node.js - 无法从 nodemailer 发送电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48995754/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com