@sap-cloud-sdk/mail-client
Advanced tools
Comparing version 3.22.3-20241114014128.0 to 3.22.3-20241114134823.0
@@ -128,9 +128,18 @@ "use strict"; | ||
const response = []; | ||
for (const mailConfigIndex in mailConfigs) { | ||
logger.debug(`Sending email ${mailConfigIndex + 1}/${mailConfigs.length}...`); | ||
response[mailConfigIndex] = await transport.sendMail({ | ||
...mailConfigsFromDestination, | ||
...mailConfigs[mailConfigIndex] | ||
}); | ||
logger.debug(`...email ${mailConfigIndex + 1}/${mailConfigs.length} for subject "${mailConfigs[mailConfigIndex].subject}" was sent successfully.`); | ||
for (const [mailConfigIndex, mailConfig] of mailConfigs.entries()) { | ||
try { | ||
logger.debug(`Sending email ${mailConfigIndex + 1}/${mailConfigs.length}...`); | ||
response[mailConfigIndex] = await transport.sendMail({ | ||
...mailConfigsFromDestination, | ||
...mailConfig | ||
}); | ||
logger.debug(`...email ${mailConfigIndex + 1}/${mailConfigs.length} with subject "${mailConfig.subject}" was sent successfully.`); | ||
} | ||
catch (error) { | ||
logger.error(`Failed to send email ${mailConfigIndex + 1}/${mailConfigs.length} with subject "${mailConfig.subject}". Error: ${error.message}`); | ||
response[mailConfigIndex] = { | ||
response: error.response, | ||
rejected: error.rejected | ||
}; | ||
} | ||
} | ||
@@ -140,13 +149,21 @@ return response; | ||
async function sendMailInParallel(transport, mailConfigsFromDestination, mailConfigs) { | ||
const promises = mailConfigs.map((mailConfig, mailConfigIndex, mailConfigsArray) => { | ||
logger.debug(`Sending email ${mailConfigIndex + 1}/${mailConfigsArray.length}...`); | ||
return transport.sendMail({ | ||
...mailConfigsFromDestination, | ||
...mailConfig | ||
}); | ||
const promises = mailConfigs.map(async (mailConfig, mailConfigIndex, mailConfigsArray) => { | ||
try { | ||
logger.debug(`Sending email ${mailConfigIndex + 1}/${mailConfigsArray.length}...`); | ||
const response = await transport.sendMail({ | ||
...mailConfigsFromDestination, | ||
...mailConfig | ||
}); | ||
logger.debug(`...email ${mailConfigIndex + 1}/${mailConfigs.length} with subject "${mailConfig.subject}" was sent successfully.`); | ||
return response; | ||
} | ||
catch (error) { | ||
logger.error(`Failed to send email ${mailConfigIndex + 1}/${mailConfigs.length} with subject "${mailConfig.subject}". Error: ${error.message}`); | ||
return { | ||
response: error.response, | ||
rejected: error.rejected | ||
}; | ||
} | ||
}); | ||
return Promise.all(promises).then(responses => { | ||
responses.forEach((_, responseIndex) => logger.debug(`...email ${responseIndex + 1}/${mailConfigs.length} for subject "${mailConfigs[responseIndex].subject}" was sent successfully`)); | ||
return responses; | ||
}); | ||
return Promise.all(promises); | ||
} | ||
@@ -153,0 +170,0 @@ async function sendMailWithNodemailer(mailDestination, mailConfigs, mailClientOptions) { |
{ | ||
"name": "@sap-cloud-sdk/mail-client", | ||
"version": "3.22.3-20241114014128.0", | ||
"version": "3.22.3-20241114134823.0", | ||
"description": "SAP Cloud SDK for JavaScript e-mail client", | ||
@@ -37,8 +37,7 @@ "homepage": "https://sap.github.io/cloud-sdk/docs/js/overview", | ||
"check:dependencies": "depcheck .", | ||
"check:public-api": "ts-node ../../scripts/check-public-api-cli.ts", | ||
"readme": "ts-node ../../scripts/replace-common-readme.ts" | ||
}, | ||
"dependencies": { | ||
"@sap-cloud-sdk/connectivity": "^3.22.3-20241114014128.0", | ||
"@sap-cloud-sdk/util": "^3.22.3-20241114014128.0", | ||
"@sap-cloud-sdk/connectivity": "^3.22.3-20241114134823.0", | ||
"@sap-cloud-sdk/util": "^3.22.3-20241114134823.0", | ||
"nodemailer": "6.9.16", | ||
@@ -45,0 +44,0 @@ "socks": "2.8.3" |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41074
692