Skip to content

Node.js based forum software built for the modern web

closes #2183

psychobunny47fb8e81255d
diff --git a/src/emailer.js b/src/emailer.js
index 1187bb4a57..4f2e59c325 100644
--- a/src/emailer.js
+++ b/src/emailer.js
@@ -10,6 +10,7 @@ var fs = require('fs'),
Plugins = require('./plugins'),
meta = require('./meta'),
translator = require('../public/src/modules/translator'),
+ tjs = require('templates.js'),
app;
@@ -48,11 +49,11 @@ var fs = require('fs'),
function renderAndTranslate(tpl, params, callback) {
async.waterfall([
function(next) {
- app.render('emails/partials/footer' + (tpl.indexOf('_plaintext') !== -1 ? '_plaintext' : ''), params, next);
+ render('emails/partials/footer' + (tpl.indexOf('_plaintext') !== -1 ? '_plaintext' : ''), params, next);
},
function(footer, next) {
params.footer = footer;
- app.render(tpl, params, next);
+ render(tpl, params, next);
},
function(html, next) {
translator.translate(html, lang, function(translated) {
@@ -62,6 +63,15 @@ var fs = require('fs'),
], callback);
}
+ function render(tpl, params, next) {
+ if (meta.config['email:custom:' + tpl.replace('emails/', '')]) {
+ var text = templates.parse(meta.config['email:custom:' + tpl.replace('emails/', '')], params);
+ next(null, text);
+ } else {
+ app.render(tpl, params, next);
+ }
+ }
+
callback = callback || function() {};
if (!Plugins.hasListeners('action:email.send')) {