diff --git a/lib/emailjs.js b/lib/emailjs.js index 24361b0..e3059a1 100644 --- a/lib/emailjs.js +++ b/lib/emailjs.js @@ -308,8 +308,9 @@ exportable = (function () { options = options || {}; var template = templates[options.template]; + var isHTML = options.isHTML; - if (!template) { + if (!template && !isHTML) { return handleExcp(cb, 'Template not found: '+options.template); } if (!options.to || !options.subject) { @@ -318,7 +319,7 @@ exportable = (function () { } options.from = options.from || defaultFrom; - renderMail(template, content) + renderMail(template, content, options) .then(function (results) { options.html = results.html; options.text = results.text; @@ -375,9 +376,13 @@ exportable = (function () { return deferred.promise; } - function renderMail (template, content) { + function renderMail (template, content, options) { var deferred = Q.defer(); - + if (options.isHTML && content) { + console.log('---------- Allowed sending custom email --------------'); + deferred.resolve(content); + return deferred.promise; + } if (template) { template.render(content, function (err, results) { if (err) { @@ -473,4 +478,4 @@ exportable = (function () { return emailJS; })(); -module.exports = exports = exportable; +module.exports = exports = exportable; \ No newline at end of file