Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
`
const fromEmail = 'contact@serverless.com'
const replyTo = formData.email || 'no-reply@serverless.com'
const subject = `New submission on form ${formData.formId}`
console.log('to', to)
const msg = {
to: to,
from: fromEmail,
replyTo: replyTo,
subject: subject,
html: emailContent,
}
sgMail.sendMultiple(msg, function (error, response) {
if (error) {
console.log('Sendgrid error response received', error)
}
return callback(error, response)
})
}
chunks.forEach(function(to) {
const msg = {
to: to,
from: 'dan@dominusgame.net',
templateId: job.data.templateName
};
if (Meteor.settings.public.dominusIsDev) {
//console.log('sendToMailingList', job.data.templateName, to.length);
console.log(msg);
sgMail.sendMultiple(msg);
} else {
sgMail.sendMultiple(msg);
}
});
console.log("Sending emails to: " + attendeeEmails);
const msg = {
to: attendeeEmails,
from: {
name: 'Gathio',
email: 'notifications@gath.io',
},
templateId: 'd-e21f3ca49d82476b94ddd8892c72a162',
dynamic_template_data: {
subject: 'gathio: Event "' + event.name + '" deleted',
actionType: 'deleted',
eventExists: false,
eventID: req.params.eventID
}
}
sgMail.sendMultiple(msg);
}
else {
console.log("Nothing to send!");
}
});
}
const sendEmails = (emails, content) => {
const msg = {
to: emails,
from: 'opentourismplatform@gmail.com',
templateId: '0839aec2-dd34-459d-9493-4fd9682b9073',
substitutions: {
name: content.en.name,
id: content._id
}
}
sgMail
.sendMultiple(msg)
}
sendMultiple(mailData: ReadonlyArray) {
return fromPromise(sendGrid.sendMultiple(mailData as any))
}
}
sendMultiple(mailData, callback = () => {}) {
return client.sendMultiple(mailData, (error) => {
if (error) {
logger.error(`${TAG} ` + JSON.stringify(error));
callback(error);
} else {
callback();
}
});
}
/**