Skip to content

Instantly share code, notes, and snippets.

@lislon
Last active August 29, 2015 14:14
Show Gist options
  • Save lislon/1ba5d17e2f88210c35a8 to your computer and use it in GitHub Desktop.
Save lislon/1ba5d17e2f88210c35a8 to your computer and use it in GitHub Desktop.
Email.send = function(templateName, templateData, options, cb) {
emailTemplates(derp.settings.noti.templatesDir, function(err, template) {
if (err) { return cb(err) }
var transport = nodemailer.createTransport(_.result(derp.settings.noti.emailTransport))
template(templateName, templateData, function(err, html, text) {
if (err) { return cb(err) }
var templates = require(__dirname + '/../../' + derp.settings.noti.templatesDir + '/templates.js')
if (!(templateName in templates)) { return cb(new Error("Template " + templateName + " are not found in templatesIndex")) }
var tplSet = templates[templateName]
var emailSettings = {
from: tplSet.from,
to: tplSet.to,
subject: jade.compile(tplSet.subjectJade, templateData),
html: html,
text: text,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment