本文介绍了无法从nodemailer发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Hi I am using nodemailer to send email. My nodejs application is deployed on gcp instance with nginx reverse proxy. My code is able to send email locally but not from server. Note that ssl is also enabled.

请注意,此命令不是从 telnet smtp.1and1.com 587

note that this command is not running from 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,因此您将无法使用该端口发送任何电子邮件.有关更多信息,请访问从实例发送电子邮件,其中显示:

Google has blocked port 587 at the instance level, so you won't be able to send any email using that port. For more on information, visit Sending Email from an Instance which says:

但是,有一个逐步的设置指南,称为您可以通过SendGrid发送电子邮件.

However, there is a step by step guide for setiing up called Sending Email with SendGrid which you can follow.

这篇关于无法从nodemailer发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 18:33
查看更多