nodemailer-express-handlebars icon indicating copy to clipboard operation
nodemailer-express-handlebars copied to clipboard

html versus plain

Open bluenike opened this issue 8 years ago • 4 comments

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

bluenike avatar Jan 11 '17 00:01 bluenike

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

yads avatar Jan 30 '17 20:01 yads

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

bluenike avatar Jan 31 '17 03:01 bluenike

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.

patchlog avatar Jan 29 '18 19:01 patchlog

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 )

knoxcard avatar Feb 01 '18 15:02 knoxcard