您好我使用nodemailer使用cpanel发送电子邮件我收到错误 { “code”:“EHOSTUNREACH”, “errno”:“EHOSTUNREACH”, “系统调用”:“连接” }
以下是发送电子邮件的代码
var transporter = nodemailer.createTransport({
host: 'hostname',
port: 25,
auth: {
user: '----domain.com',
pass: '********'
}
var mailOptions = {
from: '-----@domain.com',
to: '-------@gmail.com',
subject: 'Order Recipt',
text: 'html'
};
// send mail with defined transport object
transporter.sendMail(mailOptions, function(error, info){
if(error){
console.log("Error type:", error.name);
console.log("SMTP log:", error);
}
else {
console.log('Message sent: ' + info.response);
}
});
可以任何身体帮助!!