我正在尝试使用node.js nodemailer模块连接到Microsoft邮件服务器。但是我得到了一个错误。
// create reusable transporter object using the default SMTP transport
let transporter = nodemailer.createTransport({
host: 'mysmtp.server.com',
port: 25,
secure: false, // true for 465, false for other ports
requireTLS: true,
ignoreTLS: false,
tls : {
rejectUnauthorized: false
},
authMethod: 'LOGIN',
auth: {
type: 'login',
user: 'account@domain.com', // generated ethereal user
pass: 'password' // generated ethereal password
}
});
transporter.verify(function(error, success) {
if (error) {
console.log(error);
} else {
console.log('Server is ready to take our messages');
}
});
ERROR:
{ Error: Invalid login: 504 5.7.4 Unrecognized authentication type
at SMTPConnection._formatError (C:\Users\user\Desktop\mail\node_modules\
nodemailer\lib\smtp-connection\index.js:577:19)
at SMTPConnection._actionAUTHComplete (C:\Users\user\Desktop\mail\node_m
odules\nodemailer\lib\smtp-connection\index.js:1306:34)
at SMTPConnection._responseActions.push.str (C:\Users\user\Desktop\mail\
node_modules\nodemailer\lib\smtp-connection\index.js:349:26)
at SMTPConnection._processResponse (C:\Users\user\Desktop\mail\node_modu
les\nodemailer\lib\smtp-connection\index.js:733:20)
at SMTPConnection._onData (C:\Users\user\Desktop\mail\node_modules\nodem
ailer\lib\smtp-connection\index.js:529:14)
at TLSSocket._socket.on.chunk (C:\Users\user\Desktop\mail\node_modules\n
odemailer\lib\smtp-connection\index.js:680:51)
at emitOne (events.js:96:13)
at TLSSocket.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:176:18)
at TLSSocket.Readable.push (_stream_readable.js:134:10)
code: 'EAUTH',
response: '504 5.7.4 Unrecognized authentication type',
responseCode: 504,
command: 'AUTH PLAIN' }
有谁知道出了什么问题?
由于