Merge branch 'development' of github.com:Mailtrain-org/mailtrain into development-tb

This commit is contained in:
Tomas Bures 2019-06-15 10:25:21 +02:00
commit 4736afd5ab
2 changed files with 11 additions and 3 deletions

View file

@ -1,6 +1,6 @@
FROM node:10.14-alpine FROM node:10.14-alpine
RUN apk add --update pwgen netcat-openbsd python make gcc git g++ bash RUN apk add --update pwgen netcat-openbsd python make gcc git g++ bash imagemagick
# First install dependencies # First install dependencies
COPY server/package.json /app/server/package.json COPY server/package.json /app/server/package.json

View file

@ -3,6 +3,8 @@
const mailers = require('./mailers'); const mailers = require('./mailers');
const tools = require('./tools'); const tools = require('./tools');
const templates = require('../models/templates'); const templates = require('../models/templates');
const { getMergeTagsForBases } = require('../../shared/templates');
const { getTrustedUrl, getSandboxUrl, getPublicUrl } = require('../lib/urls');
class TemplateSender { class TemplateSender {
constructor(options) { constructor(options) {
@ -27,15 +29,21 @@ class TemplateSender {
) )
]); ]);
const variables = {
EMAIL: options.email,
...getMergeTagsForBases(getTrustedUrl(), getSandboxUrl(), getPublicUrl()),
...options.variables
};
const html = tools.formatTemplate( const html = tools.formatTemplate(
template.html, template.html,
null, null,
options.variables, variables,
true true
); );
const subject = tools.formatTemplate( const subject = tools.formatTemplate(
options.subject || template.description || template.name, options.subject || template.description || template.name,
options.variables variables
); );
return mailer.sendTransactionalMail( return mailer.sendTransactionalMail(
{ {