使用GoDaddy设置nodemailer时出错535
问题描述:
我想知道是否有人已经想出了如何使用GoDaddy托管的电子邮件与nodemailer。我从我的接触形式的电子邮件提交框,它触发了下面的脚本:使用GoDaddy设置nodemailer时出错535
function sendEmail (to, subject, body) {
var transporter = nodemailer.createTransport({
service: 'Godaddy',
host: "relay-hosting.secureserver.net",
port: 465,
secureConnection: true,
auth: {
user: '[email protected]',
pass: 'password'
}
});
var mailOptions = {
from: '[email protected]',
to: to,
subject: subject,
text: body
};
transporter.sendMail(mailOptions, function(error, info){
if (error) {
console.log(error);
} else {
console.log('Email sent: ' + info.response);
}
});
}
我已经尝试了一些不同的选择,并确保我的端口都开放,但我有一个硬与认证的时间。我不断收到这样的错误:
{ Error: Invalid login: 535 Authentication Failed for [email protected] User does not have any relays assigned.
at SMTPConnection._formatError (/var/www/node/node_modules/nodemailer/lib/smtp-connection/index.js:577:19)
at SMTPConnection._actionAUTHComplete (/var/www/node/node_modules/nodemailer/lib/smtp-connection/index.js:1306:34)
at SMTPConnection._responseActions.push.str (/var/www/node/node_modules/nodemailer/lib/smtp-connection/index.js:349:26)
at SMTPConnection._processResponse (/var/www/node/node_modules/nodemailer/lib/smtp-connection/index.js:733:20)
at SMTPConnection._onData (/var/www/node/node_modules/nodemailer/lib/smtp-connection/index.js:529:14)
at Socket._socket.on.chunk (/var/www/node/node_modules/nodemailer/lib/smtp-connection/index.js:481:47)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:176:18)
at Socket.Readable.push (_stream_readable.js:134:10)
at TCP.onread (net.js:547:20)
code: 'EAUTH',
response: '535 Authentication Failed for [email protected] User does not have any relays assigned.',
responseCode: 535,
command: 'AUTH PLAIN' }
任何想法或建议将非常感激。
答
看来这个错误与主机名有关。试试这个:
var transporter2 = nodemailer.createTransport({
service: 'Godaddy',
host: "smtpout.secureserver.net",
secureConnection: true,
port: 465
})