我试图使用nodemailer
(https://www.npmjs.com/package/nodemailer)使用本地Windows服务器发送电子邮件,使用SMTP虚拟服务器。NodeJS nodemailer - IIS SMTP虚拟服务器
SMTP虚拟服务器工作正常,我们已经在传统ASP中使用Jmail,将它传递给服务器名称,并发送电子邮件。
var nodemailer = require('nodemailer');
var options = {
host: 'SERVERNAME'
};
var transporter = nodemailer.createTransport(options);
var email = {
from: '[email protected]',
to: '[email protected]',
subject: 'hello',
text: 'hello world!'
};
var callback = function(err, info){
if (err) { throw err }
console.log('sent');
}
transporter.sendMail(email, callback);
我回来从这个错误是:
Can't send mail - all recipients were rejected: 550 5.7.1 Unable to relay for [email protected]
如果我更新options
对象包括auth
,像这样:
var options = {
host: 'SERVERNAME',
auth: {
user: '...',
pass: '...'
}
};
我得到这个错误:
Invalid login: 504 5.7.4 Unrecognized authentication type
如何使用我们的IIS SMTP虚拟服务器,使用nodemailer
发送电子邮件..?