Closed averri closed 4 years ago
I would like to know how to add support to internationalization of email templates using the project https://formatjs.io/handlebars/.
This is the basic code used to send emails:
const nodemailer = require('nodemailer') const hbs = require('nodemailer-express-handlebars') const transport = nodemailer.createTransport({ host: 'localhost', port: 1025, ignoreTLS: true, secure: false }) transport.use('compile', hbs({ viewEngine: { extName: '.hbs', partialsDir: 'src/templates', layoutsDir: 'src/templates/layouts', defaultLayout: 'main.hbs', }, viewPath: 'src/templates', extName: '.hbs' })) transport.sendMail({ from: 'alex@email.com', to: 'otheruser@email.com', subject: 'Confirm Login', template: 'confirm-login', context: { user: 'alex' } })
This seems like a question for the formatjs folks. This package just passes through templates to handlebars directly. So the question is how to integrate express-handlebars and formatjs.
I would like to know how to add support to internationalization of email templates using the project https://formatjs.io/handlebars/.
This is the basic code used to send emails: