Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function sendWeeklyBestOfEmail(user, data, digestDate) {
const debug = createDebug('freefeed:BestOfDigestMailer');
// TODO: const subject = config.mailer.weeklyBestOfDigestEmailSubject
const emailBody = ReactDOMServer.renderToStaticMarkup(SummaryEmail(data));
const emailBodyWithInlineStyles = await juice.juiceResourcesAsync(emailBody, (err, html) => {
debug('Error occurred while trying to inline styles', err, html);
});
const attachments = [fa['fa-heart'], fa['fa-lock'], fa['fa-comment-o'], fa['post-protected'], fa['fa-chevron-right']];
return Mailer.sendMail(user, `The best of your FreeFeed for the week of ${digestDate}`, {
digest: {
body: emailBodyWithInlineStyles,
date: digestDate
},
recipient: user,
baseUrl: config.host,
mailerConfig: { subjectTransformation: (subject) => subject, },
}, `${config.appRoot}/app/scripts/views/mailer/weeklyBestOfDigest.ejs`, true, attachments);
}
export async function sendDailyBestOfEmail(user, data, digestDate) {
const debug = createDebug('freefeed:BestOfDigestMailer');
// TODO: const subject = config.mailer.dailyBestOfDigestEmailSubject
const emailBody = ReactDOMServer.renderToStaticMarkup(SummaryEmail(data));
const emailBodyWithInlineStyles = await juice.juiceResourcesAsync(emailBody, (err, html) => {
debug('Error occurred while trying to inline styles', err, html);
});
const attachments = [fa['fa-heart'], fa['fa-lock'], fa['fa-comment-o'], fa['post-protected'], fa['fa-chevron-right']];
return Mailer.sendMail(user, `The best of your FreeFeed for ${digestDate}`, {
digest: {
body: emailBodyWithInlineStyles,
date: digestDate
},
recipient: user,
baseUrl: config.host,
mailerConfig: { subjectTransformation: (subject) => subject, },
}, `${config.appRoot}/app/scripts/views/mailer/dailyBestOfDigest.ejs`, true, attachments);
}