Looged amazon send bulk email response, fixed some emails not sent bug
This commit is contained in:
@@ -123,6 +123,7 @@ const sendBulkEmail = async (marketAlerts) => {
|
||||
})
|
||||
|
||||
}
|
||||
console.log("AWS EMAIL : Bulk email replacement data:");
|
||||
console.log(destinations);
|
||||
|
||||
var params = {
|
||||
@@ -138,7 +139,9 @@ const sendBulkEmail = async (marketAlerts) => {
|
||||
|
||||
// Create the promise and SES service object
|
||||
const sendPromise = new AWS.SES({ apiVersion: '2010-12-01' }).sendBulkTemplatedEmail(params).promise();
|
||||
await sendPromise;
|
||||
const awsResult = await sendPromise;
|
||||
console.log("AWS SES bulk email response");
|
||||
console.log(awsResult);
|
||||
|
||||
|
||||
} catch (e) {
|
||||
@@ -151,10 +154,10 @@ const sendBulkEmail = async (marketAlerts) => {
|
||||
const toAWSArray = (urlArray) => {
|
||||
let arrayString = ""
|
||||
urlArray.forEach(element => {
|
||||
arrayString = arrayString + `{"url":"${element.url}" , "title":"${element.title}"},`
|
||||
arrayString = arrayString + `{"url":"${element.url.trim()}" , "title":"${element.title.replace(/"/g, "")}"},`
|
||||
});
|
||||
|
||||
return arrayString.slice(0, -1);;
|
||||
return arrayString.slice(0, -1);
|
||||
}
|
||||
|
||||
const getNotificationEmailHtml = () => {
|
||||
@@ -177,7 +180,7 @@ const createMarketAlertEmailTemplate = async () => {
|
||||
Template: {
|
||||
TemplateName: "MarketAlertTemplate",
|
||||
SubjectPart: "Javi mi obavijest",
|
||||
TextPart: "Dear ,\r\nYour favorite animal is {{marketAlertUrl}}.",
|
||||
TextPart: getNotificationEmailText(),
|
||||
HtmlPart: getNotificationEmailHtml()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ async function processNotifications() {
|
||||
await sendBulkEmail(marketAlerts);
|
||||
} else {
|
||||
console.log("NOTIFICATION SERVICE: No new alerts");
|
||||
return;
|
||||
}
|
||||
|
||||
await db.MarketAlert.update(
|
||||
|
||||
Reference in New Issue
Block a user