saasgear icon indicating copy to clipboard operation
saasgear copied to clipboard

Fix send email

Open davidtran opened this issue 3 years ago • 0 comments

export default function generateEmailTemplate({ fileName, data }) {
  const templatePath = `${path.resolve()}/email-template/${fileName}`;
  const template = execSync(`mjml ${templatePath}`).toString();
  return handlebars.compile(template)(data).toString();
}
  • please use mjml npm package to compile email
  • never use NodeJS sync method. It hurts app performance. Use async/await or Promise instead.

davidtran avatar Nov 26 '20 07:11 davidtran