I am trying to send an email using nodemailer
and a custom email address configured through GoDaddy. Here is a screen shot of the "custom configurations" page in c-panel:
和我的代码:
const nodemailer = require('nodemailer');
var transporter = nodemailer.createTransport({
service: 'Godaddy',
secureConnection: false,
auth: {
user: '[email protected]',
pass: 'mypassword'
}
});
var mailOptions = {
from: '[email protected]',
to: '[email protected]',
subject: 'Sending Email using Node.js',
text: 'That was easy!',
html: '<h1>Welcome</h1><p>That was easy!</p>'
};
transporter.sendMail(mailOptions, function(error, info){
if (error) {
console.log(error);
} else {
console.log('Email sent: ' + info.response);
}
});
和我的错误日志:
{ Error: connect EHOSTUNREACH 173.201.192.101:25
at Object.exports._errnoException (util.js:1012:11)
at exports._exceptionWithHostPort (util.js:1035:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1080:14)
code: 'ECONNECTION',
errno: 'EHOSTUNREACH',
syscall: 'connect',
address: '173.201.192.101',
port: 25,
command: 'CONN' }
我尝试过更改端口号,使其安全而不是非 ssl,使用我的网站地址作为主机,以及我能想到的几乎所有其他内容。我已使用其中一个网络邮件客户端从 godaddy 电子邮件成功发送了一封电子邮件。有其他人遇到过这种情况或者有尝试的建议吗?