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

CAPM email issue : Concurrent connections limit exceeded SAP cloud SDK mail-client

Mhsap
Discoverer
0 Kudos
106

i have to send email via CAPM for which I have used @SAP-cloud-sdk/mail-client.

The requirement is such that i need to send emails to diffrent recipeints in loop, the scenario is there is a fiori list report in which I select rows and click on Send mail button created as extension custom action for calling below code. this works fine for few emails but throws connection execceded error randomly for more number of rows.

email-handler.js

============

 await    sendMail({ destinationName: emailDestinationName }, [mailConfig], {
                            sdkOptions: {
                                parallel: false
                            }
                        }).then(() => {
                            console.log('Emails sent successfully.');
                        }).catch((err) => {
                            console.error('Failed to send emails:', err);
                        });

Failed to send emails: Error: Message failed: 432 4.3.2 Concurrent connections limit exceeded. Visit https://aka.ms/concurrent_sending

How to handle concurrent connections. Please help.

View Entire Topic
Willem_Pardaens
Product and Topic Expert
Product and Topic Expert
0 Kudos

Is your action is configured for parallel execution? There is an 'InvocationGrouping' setting which defines if an action in a list report is executed sequentially (isolated) for each of the selected items, or in parallel (change set). See https://ui5.sap.com/#/topic/cbf16c599f2d4b8796e3702f7d4aae6c

If your invocation setting is set to change set then your function will be executed in parallel so the SDK might be overloaded with requests. Switch to isolated and have a look at the Chrome Network tab to ensure there are sequential singular batch requests sent to your CAP application where the next batch is only sent when the previous one completed (returned 200).

{
  $Type : 'UI.DataFieldForAction',
  Label : 'Send email',
  Action: 'MyService.sendMail',
  InvocationGrouping : #Isolated
},

 

In case you want to send bulk emails, it would be better to use an action defined in an extension instead of a standard Fiori Elements action. In such custom action you will receive a single call in the extension handler with a list of selected rows so you can execute the sendEmail to all receivers at once.