Unable to send email from nodemailer

你。 提交于 2021-02-10 04:36:48

问题


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.

note that this command is not running from telnet smtp.1and1.com 587

but this is running telnet smtp.gmail.com 587

This is my code

var transporterOptions = {
host: "smtp.1and1.com",
port: 587,
auth: {
    user: email,
    pass: pass
},
secure:true
};

回答1:


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:

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.

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



来源:https://stackoverflow.com/questions/48995754/unable-to-send-email-from-nodemailer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!