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

403 Forbidden Error When Sending Email via SAP Cloud SDK from SAP Build Work Zone

Syed_Hussaini19
Explorer
0 Likes
397

 

Hi SAP Experts,

I have developed and deployed an SAP BTP CAP application on the SAP BTP Cloud Foundry environment and integrated it with SAP Build Work Zone, Standard Edition.

I am using the SAP Cloud SDK (@Pa_Vi-cloud-sdk/mail-client) to send emails from my SAP BTP CAP application. The email functionality works perfectly when testing locally using SAP Business Application Studio (BAS) or when accessing the application directly in the Cloud Foundry environment in SAP BTP.

However, when I open the application and try to send an email through SAP Build Work Zone, Standard Edition, I encounter a 403 Forbidden error while sending an email.

I have already added the necessary routes in the xs-app.json file, but the issue persists.

Has anyone faced a similar issue? Are there additional configurations required for SAP Build Work Zone to allow outbound email requests?

Any insights or suggestions would be greatly appreciated!

xs-app.json:

xs-app.json
{
  "welcomeFile": "/index.html",
  "authenticationMethod": "route",
  "routes": [
 {
      "source": "^/MailService/(.*)$",
      "target": "/MailService/$1",
      "destination": "srv",
      "authenticationType": "xsuaa",
      "csrfProtection": false
    }
  ]
}

srv > mail.cds:

@protocol: 'rest'
@path    : '/MailService'
service Catalog {

   @open
   type object {};
action sendemail();
}

Error:

Syed_Hussaini_1-1743674582097.pngSyed_Hussaini_2-1743674615740.png

Regards,
Syed

Accepted Solutions (0)

Answers (1)

Answers (1)

gregorw
SAP Mentor
SAP Mentor

Make sure that you call the endpoint via the relative path. Cross check Calling Service using AJAX in Fiori Elements Extension doesn't work in Launchpad