使用Nodemailer从Zohomail发送邮件时发生连接超时错误

以下是我的Node app.js代码。 使用这些设置,我收到连接超时错误。 任何想法,我在这里失踪?

var nodemailer = require("nodemailer"); var transporter = nodemailer.createTransport({ host: 'smtp.zoho.com', port: 465, secure: true, // use SSL auth: { user: '<myemail@example.com>', pass: '<myemailpassword>' } }); var mailOptions = { from: "<fromemail@example.com>", to: "<toemail@example.com>", subject: "Hello", generateTextFromHTML: true, html: { path: './tmpl.html' } }; transporter.sendMail(mailOptions, function(error, response) { if (error) { console.log(error); } else { console.log(response); } transporter.close(); }); 

显示错误

 { Error: Connection timeout at SMTPConnection._formatError (/home/ubuntu/workspace/mailapp/node_modules/nodemailer/lib/smtp-connection/index.js:557:19) at SMTPConnection._onError (/home/ubuntu/workspace/mailapp/node_modules/nodemailer/lib/smtp-connection/index.js:530:20) at Timeout._connectionTimeout.setTimeout (/home/ubuntu/workspace/mailapp/node_modules/nodemailer/lib/smtp-connection/index.js:248:18) at ontimeout (timers.js:380:14) at tryOnTimeout (timers.js:244:5) at Timer.listOnTimeout (timers.js:214:5) code: 'ETIMEDOUT', command: 'CONN' } 

谁能帮帮我吗?

一些云提供商禁用端口像465和587,尝试使用端口2525而不是465。

更新

由于您使用Cloud9为此,我发现他们已经阻止了从他们的服务器的所有出站smtp调用。 如果您需要发送任何信息,则需要select另一个云提供商或使用其推荐的服务之一。

https://community.c9.io/t/how-can-i-send-email-from-my-app/1262