yads / nodemailer-express-handlebars

A plugin for nodemailer that uses express-handlebars view engine to generate emails
85 stars 29 forks source link

html versus plain #10

Open bluenike opened 7 years ago

bluenike commented 7 years ago

Is it possible to specify a template for the plaintext version of the email (in addition to the html version)?

yads commented 7 years ago

You would have to create 2 separate tansporters, one for plain text and one for html.

bluenike commented 7 years ago

Will that allow you to create a multipart message that encapsulates text and html versions of the email in single message?

patchlog commented 6 years ago

I fixed this and created a pull request (https://github.com/yads/nodemailer-express-handlebars/pull/13 ). After applying my patch just define the "text_template" and nodemailer will create a multipart/alternative message.

knoxcard commented 6 years ago

Currently employing a quick hack solution on a production server, somewhere along the lines listed below:

var template_name = 'create_account'
var template_html = require('fs').readFileSync(require('path').join(__dirname, '../templates/emails/' + template_name + '.hbs'), 'utf8')
var template_text = require('striptags')(template_html )