From 39f3682c27d6e548e11df394f7b42a5d00f29893 Mon Sep 17 00:00:00 2001 From: Alexander Gusev Date: Tue, 11 Jun 2019 19:37:45 +0300 Subject: [PATCH] fix(transactionalApi): added getting of variables to TemplateSender [Resolves #606] --- server/lib/template-sender.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/server/lib/template-sender.js b/server/lib/template-sender.js index bcbd4db5..534df7fe 100644 --- a/server/lib/template-sender.js +++ b/server/lib/template-sender.js @@ -3,6 +3,8 @@ const mailers = require('./mailers'); const tools = require('./tools'); const templates = require('../models/templates'); +const { getMergeTagsForBases } = require('../../shared/templates'); +const { getTrustedUrl, getSandboxUrl, getPublicUrl } = require('../lib/urls'); class TemplateSender { constructor(options) { @@ -27,15 +29,21 @@ class TemplateSender { ) ]); + const variables = { + EMAIL: options.email, + ...getMergeTagsForBases(getTrustedUrl(), getSandboxUrl(), getPublicUrl()), + ...options.variables + }; + const html = tools.formatTemplate( template.html, null, - options.variables, + variables, true ); const subject = tools.formatTemplate( options.subject || template.description || template.name, - options.variables + variables ); return mailer.sendTransactionalMail( {