axrising
@axrising

Ошибка при отправке письма на почту nodemailer, gmail?

Подскажите почему появлятся вот эта ошибка при попытке отправить сообщение с nodejs?
'534-5.7.14  Learn more at\n' +
    '534 5.7.14  https://support.google.com/mail/answer/78754 d7sm1868963qth.70 - gsmtp',
  responseCode: 534,
  command: 'AUTH PLAIN'
}
2021-07-29T22:52:33.905Z	86eef5db-c86c-44e7-8f39-de3f74f417ae	ERROR	Unhandled Promise Rejection 	{"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"Error: Invalid login: 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbu\n534-5.7.14 va-73oYnId42dUGqykJLJKgdOuQvhV9UDHvWAcmdt6dbP0Mn4g4QR5Gr3XtVdBdGKPTh4\n534-5.7.14 A1KRuNYwd0SXW9ViAyaJzoEUe37DyuBgd31I5J-YO6_NQD7sKmkYJJ4lg1i8s4wB>\n534-5.7.14 Please log in via your web browser and then try again.\n534-5.7.14  Learn more at\n534 5.7.14  https://support.google.com/mail/answer/78754 d7sm1868963qth.70 - gsmtp","reason":{"errorType":"Error","errorMessage":"Invalid login: 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbu\n534-5.7.14 va-73oYnId42dUGqykJLJKgdOuQvhV9UDHvWAcmdt6dbP0Mn4g4QR5Gr3XtVdBdGKPTh4\n534-5.7.14 A1KRuNYwd0SXW9ViAyaJzoEUe37DyuBgd31I5J-YO6_NQD7sKmkYJJ4lg1i8s4wB>\n534-5.7.14 Please log in via your web browser and then try again.\n534-5.7.14  Learn more at\n534 5.7.14  https://support.google.com/mail/answer/78754 d7sm1868963qth.70 - gsmtp","code":"EAUTH","response":"534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbu\n534-5.7.14 va-73oYnId42dUGqykJLJKgdOuQvhV9UDHvWAcmdt6dbP0Mn4g4QR5Gr3XtVdBdGKPTh4\n534-5.7.14 A1KRuNYwd0SXW9ViAyaJzoEUe37DyuBgd31I5J-YO6_NQD7sKmkYJJ4lg1i8s4wB>\n534-5.7.14 Please log in via your web browser and then try again.\n534-5.7.14  Learn more at\n534 5.7.14  https://support.google.com/mail/answer/78754 d7sm1868963qth.70 - gsmtp","responseCode":534,"command":"AUTH PLAIN","stack":["Error: Invalid login: 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbu","534-5.7.14 va-73oYnId42dUGqykJLJKgdOuQvhV9UDHvWAcmdt6dbP0Mn4g4QR5Gr3XtVdBdGKPTh4","534-5.7.14 A1KRuNYwd0SXW9ViAyaJzoEUe37DyuBgd31I5J-YO6_NQD7sKmkYJJ4lg1i8s4wB>","534-5.7.14 Please log in via your web browser and then try again.","534-5.7.14  Learn more at","534 5.7.14  https://support.google.com/mail/answer/78754 d7sm1868963qth.70 - gsmtp","    at SMTPConnection._formatError (/var/task/node_modules/nodemailer/lib/smtp-connection/index.js:784:19)","    at SMTPConnection._actionAUTHComplete (/var/task/node_modules/nodemailer/lib/smtp-connection/index.js:1536:34)","    at SMTPConnection.<anonymous> (/var/task/node_modules/nodemailer/lib/smtp-connection/index.js:540:26)","    at SMTPConnection._processResponse (/var/task/node_modules/nodemailer/lib/smtp-connection/index.js:947:20)","    at SMTPConnection._onData (/var/task/node_modules/nodemailer/lib/smtp-connection/index.js:749:14)","    at TLSSocket.SMTPConnection._onSocketData (/var/task/node_modules/nodemailer/lib/smtp-connection/index.js:189:44)","    at TLSSocket.emit (events.js:375:28)","    at addChunk (internal/streams/readable.js:290:12)","    at readableAddChunk (internal/streams/readable.js:265:9)","    at TLSSocket.Readable.push (internal/streams/readable.js:204:10)"]},"promise":{},"stack":["Runtime.UnhandledPromiseRejection: Error: Invalid login: 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbu","534-5.7.14 va-73oYnId42dUGqykJLJKgdOuQvhV9UDHvWAcmdt6dbP0Mn4g4QR5Gr3XtVdBdGKPTh4","534-5.7.14 A1KRuNYwd0SXW9ViAyaJzoEUe37DyuBgd31I5J-YO6_NQD7sKmkYJJ4lg1i8s4wB>","534-5.7.14 Please log in via your web browser and then try again.","534-5.7.14  Learn more at","534 5.7.14  https://support.google.com/mail/answer/78754 d7sm1868963qth.70 - gsmtp","    at process.<anonymous> (/var/runtime/index.js:35:15)","    at process.emit (events.js:387:35)","    at processPromiseRejections (internal/process/promises.js:245:33)","    at processTicksAndRejections (internal/process/task_queues.js:96:32)"]}
Unknown application error occurred


Мой код
function sendEmail(message: SendEmailProps) {
  return new Promise((res, rej) => {
    const transporter = nodemailer.createTransport({
      service: 'gmail',
      auth: {
        user: 'q****@gmail.com',
        pass: '*****',
      },
    })
    transporter.sendMail(message, function (err, info) {
      if (err) {
        console.log(err)
        rej(err)
      } else {
        console.log(info)
        res(info)
      }
    })
  })
}


На locallhost все работает
  • Вопрос задан
  • 34 просмотра
Пригласить эксперта
Ответы на вопрос 1
progspectar
@progspectar
Краткость сестра нашего брата
Сложно сказать, не увидев кода, но например можно попробовать изменить настройки в google-accounte:
https://edigleyssonsilva.medium.com/how-to-send-em...
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы