Last active
August 29, 2015 14:14
-
-
Save lislon/1ba5d17e2f88210c35a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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