boot/mailer.js
function render (template, locals, callback) {
  var engineExt =
  engineName.charAt(0) === '.' ? engineName : ('.' + engineName)
  var tmplPath = path.join(templatesDir, template + engineExt)
  var origTmplPath = path.join(origTemplatesDir, template + engineExt)

  function renderToText (html) {
    var text = htmlToText.fromString(html, {
      wordwrap: 72 // A little less than 80 characters per line is the de-facto
    // standard for e-mails to allow for some room for quoting
    // and e-mail client UI elements (e.g. scrollbar)
    })

    callback(null, html, text)
  }

  engine(tmplPath, locals)
    .then(renderToText)
    .catch(function () {
      engine(origTmplPath, locals)
        .then(renderToText)
        .catch(function (err) {
          callback(err)
        })
    })
}
function render (template, locals, callback) {
  var engineExt =
  engineName.charAt(0) === '.' ? engineName : ('.' + engineName)
  var tmplPath = path.join(templatesDir, template + engineExt)
  var origTmplPath = path.join(origTemplatesDir, template + engineExt)

  function renderToText (html) {
    var text = htmlToText.fromString(html, {
      wordwrap: 72 // A little less than 80 characters per line is the de-facto
    // standard for e-mails to allow for some room for quoting
    // and e-mail client UI elements (e.g. scrollbar)
    })

    callback(null, html, text)
  }

  engine(tmplPath, locals)
    .then(renderToText)
    .catch(function () {
      engine(origTmplPath, locals)
        .then(renderToText)
        .catch(function (err) {
          callback(err)
        })
    })
}
function render ( template , locals , callback ) { var engineExt = engineName . charAt ( 0 ) === '.' ? engineName : ( '.' + engineName ) var tmplPath = path . join ( templatesDir , template + engineExt ) var origTmplPath = path . join ( origTemplatesDir , template + engineExt ) function renderToText ( html ) { var text = htmlToText . fromString ( html , { wordwrap : 72 // A little less than 80 characters per line is the de-facto // standard for e-mails to allow for some room for quoting // and e-mail client UI elements (e.g. scrollbar) } ) callback ( null , html , text ) } engine ( tmplPath , locals ) . then ( renderToText ) . catch ( function ( ) { engine ( origTmplPath , locals ) . then ( renderToText ) . catch ( function ( err ) { callback ( err ) } ) } ) }
Render e-mail templates to HTML and text
Render e - mail templates to HTML and text