{ [Error: Connection timeout] code: 'ETIMEDOUT' } in nodemailer
{ [Error: Connection timeout] code: 'ETIMEDOUT' } in nodemailer
我在 cloud9 的 node.js 应用程序中使用 nodemailer 模块时遇到了一些问题。我的代码的简化版本是
mail_test : function(req, res, next){
var nodemailer = require("nodemailer");
var smtpTransport = require('nodemailer-smtp-transport');
var transport = nodemailer.createTransport(smtpTransport({
host : "smtp.webfaction.com",
secureConnection : true,
port: 465,
auth : {
user : "username",
pass : "password"
}
}));
var mailOptions={
from : "info@feedcourt.com",
to : "net.nayek@gmail.com",
subject : "Your Subject",
text : "Your Text",
/* html : "<b>HTML GENERATED</b>",
attachments : [
{ // file on disk as an attachment
filename: 'text3.txt',
path: 'Your File path' // stream this file
}
]*/
}
transport.sendMail(mailOptions, function(error, response){
if(error){
console.log(error);
res.end("error");
}else{
console.log(response.response.toString());
console.log("Message sent: " + response.message);
res.end("sent");
}
});
},
当我尝试在服务器上执行它时,出现了 ETIMEDOUT 错误
{ [Error: Connection timeout] code: 'ETIMEDOUT' }
我的模块版本是-
"nodemailer": "^2.4.2"
"nodemailer-smtp-transport": "^2.5.0"
我很沮丧。请帮助我
不允许从 cloud9 工作区发送电子邮件以阻止垃圾邮件。
有关详细信息,请参阅 https://community.c9.io/t/how-can-i-send-email-from-my-app/1262/3。
我在 cloud9 的 node.js 应用程序中使用 nodemailer 模块时遇到了一些问题。我的代码的简化版本是
mail_test : function(req, res, next){
var nodemailer = require("nodemailer");
var smtpTransport = require('nodemailer-smtp-transport');
var transport = nodemailer.createTransport(smtpTransport({
host : "smtp.webfaction.com",
secureConnection : true,
port: 465,
auth : {
user : "username",
pass : "password"
}
}));
var mailOptions={
from : "info@feedcourt.com",
to : "net.nayek@gmail.com",
subject : "Your Subject",
text : "Your Text",
/* html : "<b>HTML GENERATED</b>",
attachments : [
{ // file on disk as an attachment
filename: 'text3.txt',
path: 'Your File path' // stream this file
}
]*/
}
transport.sendMail(mailOptions, function(error, response){
if(error){
console.log(error);
res.end("error");
}else{
console.log(response.response.toString());
console.log("Message sent: " + response.message);
res.end("sent");
}
});
},
当我尝试在服务器上执行它时,出现了 ETIMEDOUT 错误
{ [Error: Connection timeout] code: 'ETIMEDOUT' }
我的模块版本是-
"nodemailer": "^2.4.2"
"nodemailer-smtp-transport": "^2.5.0"
我很沮丧。请帮助我
不允许从 cloud9 工作区发送电子邮件以阻止垃圾邮件。 有关详细信息,请参阅 https://community.c9.io/t/how-can-i-send-email-from-my-app/1262/3。