Это мой код: я пытался использовать учетную запись outlook
const transporter = nodemailer.createTransport({
host: 'smtp.office365.com',
auth: {
user: 'account@mycompanydomain.com',
pass: 'password'
}
});
transporter.verify(function(error, success) {
if (error) {
console.log(error);
} else {
console.log('Server is ready to take our messages');
}
});
Я не уверен, в чем здесь проблема. Это журналы nodemailer:
[2020-03-17 09:55:34] DEBUG Creating transport: nodemailer (6.4.5; +https://nodemailer.com/; SMTP/6.4.5[client:6.4.5])
[2020-03-17 09:55:34] DEBUG [JAejdt6KMrw] Resolved smtp.office365.com as 40.100.54.194 [cache miss]
[2020-03-17 09:55:35] INFO [JAejdt6KMrw] Connection established to 40.100.54.194:587
[2020-03-17 09:55:35] INFO [JAejdt6KMrw] Connection upgraded with STARTTLS
[2020-03-17 09:55:36] DEBUG [JAejdt6KMrw] SMTP handshake finished
[2020-03-17 09:55:41] INFO [JAejdt6KMrw] User "account@mycompanydomain.com" failed to authenticate
[2020-03-17 09:55:41] DEBUG [JAejdt6KMrw] Closing connection to the server using "end"
Error: Invalid login: 535 5.7.3 Authentication unsuccessful [HK2PR04CA0060.apcprd04.prod.outlook.com]
at SMTPConnection._formatError (C:\Users\Nonoy\Documents\sample_apps\nodemailer_outlook_integration\node_modules\nodemailer\lib\smtp-connection\index.js:784:19)
at SMTPConnection._actionAUTHComplete (C:\Users\Nonoy\Documents\sample_apps\nodemailer_outlook_integration\node_modules\nodemailer\lib\smtp-connection\index.js:1523:34)
at SMTPConnection.<anonymous> (C:\Users\Nonoy\Documents\sample_apps\nodemailer_outlook_integration\node_modules\nodemailer\lib\smtp-connection\index.js:1481:18)
at SMTPConnection._processResponse (C:\Users\Nonoy\Documents\sample_apps\nodemailer_outlook_integration\node_modules\nodemailer\lib\smtp-connection\index.js:942:20)
at SMTPConnection._onData (C:\Users\Nonoy\Documents\sample_apps\nodemailer_outlook_integration\node_modules\nodemailer\lib\smtp-connection\index.js:749:14)
at TLSSocket.SMTPConnection._onSocketData (C:\Users\Nonoy\Documents\sample_apps\nodemailer_outlook_integration\node_modules\nodemailer\lib\smtp-connection\index.js:195:44)
at TLSSocket.emit (events.js:223:5)
at addChunk (_stream_readable.js:309:12)
at readableAddChunk (_stream_readable.js:290:11)
at TLSSocket.Readable.push (_stream_readable.js:224:10) {
code: 'EAUTH',
response: '535 5.7.3 Authentication unsuccessful [HK2PR04CA0060.apcprd04.prod.outlook.com]',
responseCode: 535,
command: 'AUTH LOGIN'
}
[2020-03-17 09:55:41] INFO [JAejdt6KMrw] Connection closed
PS: домен моей компании размещен на Microsoft