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

Assistance Required: SMTP Authentication Error in BTP CAP Application

rahuljain257
Participant
0 Likes
1,224

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

 

 

Accepted Solutions (1)

Accepted Solutions (1)

MakotoS
Product and Topic Expert
Product and Topic Expert

I guess this is not a problem on SAP side but simply Gmail does not accept basic auth.

I guess the discussion here is relevant.
https://stackoverflow.com/questions/75021886/gmail-smtp-send-535-5-7-8-username-and-password-not-acc...

Answers (2)

Answers (2)

BrettJhonson
Discoverer
0 Likes


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.

S_Sriram
Active Contributor
0 Likes

Hi Rahul,

1. Check the Google account user ID and password

2. Check the SAP note for the SMTP error 3228442

Regards

SS