I am developing a website in nextjs, and when i send emails using nodemailer in my windows environment it works well both on development and production. But when i deploy the application on my ubuntu web server i am getting this error:
Error: Invalid login: 535 Authentication Failed at SMTPConnection._formatError (webpack-internal:///(rsc)/./node_modules/nodemailer/lib/smtp-connection/index.js:616:19) at SMTPConnection._actionAUTHComplete (webpack-internal:///(rsc)/./node_modules/nodemailer/lib/smtp-connection/index.js:1230:34) at SMTPConnection.eval (webpack-internal:///(rsc)/./node_modules/nodemailer/lib/smtp-connection/index.js:432:26) at SMTPConnection._processResponse (webpack-internal:///(rsc)/./node_modules/nodemailer/lib/smtp-connection/index.js:757:20) at SMTPConnection._onData (webpack-internal:///(rsc)/./node_modules/nodemailer/lib/smtp-connection/index.js:589:14) at SMTPConnection._onSocketData (webpack-internal:///(rsc)/./node_modules/nodemailer/lib/smtp-connection/index.js:144:48) at TLSSocket.emit (node:events:519:28) at addChunk (node:internal/streams/readable:559:12) at readableAddChunkPushByteMode (node:internal/streams/readable:510:3) at Readable.push (node:internal/streams/readable:390:5) at TLSWrap.onStreamRead (node:internal/stream_base_commons:191:23) at TLSWrap.callbackTrampoline (node:internal/async_hooks:130:17) { code: 'EAUTH', response: '535 Authentication Failed', responseCode: 535, command: 'AUTH PLAIN'}
here is my nodemailer configurations:
const transporter = nodeMailer.createTransport({ host: 'smtp.zoho.com', port: 465, secure: true, // use SSL auth:{ user: process.env.USER, pass: process.env.PASS }, })
the emails are zoho based emails, my@mydomain.co.ke, i have made communication to both my vps providers and zoho support but the error is not coming from their end.
Also i tried with gmail also, and the error is the same, and i have created app based password, and all the credentials are correct.
Anyone who can offer assistance, i will appreciate.