我試圖使用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
發送電子郵件..?