cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Assistance Required: SMTP Authentication Error in BTP CAP Application

rahuljain257
Participant
0 Kudos
1,097

Greetings,

I've encountered an SMTP authentication error while attempting to send an email through a BTP CAP Application. The error message is as follows:

Uncaught Error: Invalid login: 535-5.7.8 Username and Password not accepted. For more information, go to
535 5.7.8  https://support.google.com/mail/?p=BadCredentials w10-20020a0cf70a000000b006a0dbe40533sm110635qvn.135 - gsmtp
    at SMTPConnection._formatError (/home/user/projects/SDModule/node_modules/nodemailer/lib/smtp-connection/index.js:798:19)
    at SMTPConnection._actionAUTHComplete (/home/user/projects/SDModule/node_modules/nodemailer/lib/smtp-connection/index.js:1577:34)
    at SMTPConnection.<anonymous> (/home/user/projects/SDModule/node_modules/nodemailer/lib/smtp-connection/index.js:554:26)
    at SMTPConnection._processResponse (/home/user/projects/SDModule/node_modules/nodemailer/lib/smtp-connection/index.js:982:20)
    at SMTPConnection._onData (/home/user/projects/SDModule/node_modules/nodemailer/lib/smtp-connection/index.js:763:14)
    at SMTPConnection._onSocketData (/home/user/projects/SDModule/node_modules/nodemailer/lib/smtp-connection/index.js:195:44)
    at TLSSocket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9)
    at Readable.push (node:internal/streams/readable:234:10) {
  code: 'EAUTH',
  response: '535-5.7.8 Username and Password not accepted. For more information, go to\n' +
    '535 5.7.8  https://support.google.com/mail/?p=BadCredentials w10-20020a0cf70a000000b006a0dbe40533sm110635qvn.135 - gsmtp',
  responseCode: 535,
  command: 'AUTH PLAIN'

I have attached the destination configuration and a snippet of the sample code from the CAP application for reference. Any insights or suggestions to resolve this issue would be greatly appreciated.

rahuljain257_0-1714420911539.png

Sample code which I wrote to send the application -

srv.on("getNorthwindProducts", async(req) => {
        try
        {
            const mailConfig = {
              from: 'test@gmail.com',
              to: 'test@gmail.com',
              subject: 'e-mail subject',
              text: 'e-mail text'
            };
            sendMail({ destinationName: 'hotmail' }, [mailConfig]);
            return data;
        }
        catch(err) {
            console.log(err);
        }
    });

Thank you in advance for your help!

Regards

Rahul Jain

 

 

View Entire Topic
BrettJhonson
Discoverer
0 Kudos


To address the SMTP authentication error in your BTP CAP application, you might be encountering issues due to Gmail's discontinuation of basic authentication support. Consider switching to OAuth 2.0 for secure authentication.

Alternatively, you can use SMTPget, which offers reliable SMTP services compatible with various security protocols. This can help you bypass the issues with Gmail's restrictions.