diff --git a/public/images/emails/nodebb.png b/public/images/emails/nodebb.png new file mode 100644 index 0000000000..11ac9507ad Binary files /dev/null and b/public/images/emails/nodebb.png differ diff --git a/src/emailer.js b/src/emailer.js index 38d68102c1..5120ef9caf 100644 --- a/src/emailer.js +++ b/src/emailer.js @@ -25,10 +25,17 @@ var fallbackTransport; var Emailer = module.exports; +Emailer._defaultPayload = {}; Emailer.registerApp = function (expressApp) { app = expressApp; + Emailer._defaultPayload = { + url: nconf.get('url'), + site_title: meta.config.title || 'NodeBB', + 'brand:logo': nconf.get('url') + meta.config['brand:logo'], + }; + // Enable Gmail transport if enabled in ACP if (parseInt(meta.config['email:GmailTransport:enabled'], 10) === 1) { transports.gmail = nodemailer.createTransport(smtpTransport({ @@ -55,6 +62,9 @@ Emailer.send = function (template, uid, params, callback) { return callback(); } + // Combined passed-in payload with default values + params = Object.assign({}, Emailer._defaultPayload, params); + async.waterfall([ function (next) { async.parallel({ diff --git a/src/messaging/notifications.js b/src/messaging/notifications.js index 5d433b2c33..12640def03 100644 --- a/src/messaging/notifications.js +++ b/src/messaging/notifications.js @@ -124,8 +124,6 @@ module.exports = function (Messaging) { subject: '[[email:notif.chat.subject, ' + messageObj.fromUser.username + ']]', summary: '[[notifications:new_message_from, ' + messageObj.fromUser.username + ']]', message: messageObj, - site_title: meta.config.title || 'NodeBB', - url: nconf.get('url'), roomId: messageObj.roomId, username: userData.username, userslug: userData.userslug, diff --git a/src/socket.io/admin.js b/src/socket.io/admin.js index 6f1345afdd..304fdd831c 100644 --- a/src/socket.io/admin.js +++ b/src/socket.io/admin.js @@ -228,8 +228,6 @@ SocketAdmin.email.test = function (socket, data, callback) { var site_title = meta.config.title || 'NodeBB'; var payload = { subject: '[' + site_title + '] Test Email', - site_title: site_title, - url: nconf.get('url'), }; switch (data.template) { diff --git a/src/socket.io/user.js b/src/socket.io/user.js index d59fad3c58..1ed67276c4 100644 --- a/src/socket.io/user.js +++ b/src/socket.io/user.js @@ -128,7 +128,6 @@ SocketUser.reset.commit = function (socket, data, callback) { emailer.send('reset_notify', uid, { username: username, date: parsedDate, - site_title: meta.config.title || 'NodeBB', subject: '[[email:reset.notify.subject]]', }); diff --git a/src/socket.io/user/ban.js b/src/socket.io/user/ban.js index d6cfbd6f68..a61a9b83ee 100644 --- a/src/socket.io/user/ban.js +++ b/src/socket.io/user/ban.js @@ -107,7 +107,6 @@ module.exports = function (SocketUser) { var siteTitle = meta.config.title || 'NodeBB'; var data = { subject: '[[email:banned.subject, ' + siteTitle + ']]', - site_title: siteTitle, username: username, until: until ? utils.toISOString(until) : false, reason: reason, diff --git a/src/topics/follow.js b/src/topics/follow.js index 89db6b3d13..62ee424eea 100644 --- a/src/topics/follow.js +++ b/src/topics/follow.js @@ -259,7 +259,6 @@ module.exports = function (Topics) { subject: '[' + (meta.config.title || 'NodeBB') + '] ' + title, intro: '[[notifications:user_posted_to, ' + postData.user.username + ', ' + titleEscaped + ']]', postBody: postData.content.replace(/"\/\//g, '"https://'), - site_title: meta.config.title || 'NodeBB', username: data.userData.username, userslug: data.userData.userslug, url: nconf.get('url') + '/topic/' + postData.topic.tid, diff --git a/src/user/approval.js b/src/user/approval.js index d04686a7b0..4beeab6806 100644 --- a/src/user/approval.js +++ b/src/user/approval.js @@ -89,7 +89,6 @@ module.exports = function (User) { var title = meta.config.title || meta.config.browserTitle || 'NodeBB'; translator.translate('[[email:welcome-to, ' + title + ']]', meta.config.defaultLang, function (subject) { var data = { - site_title: title, username: username, subject: subject, template: 'registration_accepted', diff --git a/src/user/digest.js b/src/user/digest.js index 61b727de3a..ffd4f9031e 100644 --- a/src/user/digest.js +++ b/src/user/digest.js @@ -136,8 +136,6 @@ Digest.send = function (data, callback) { subject: '[' + meta.config.title + '] [[email:digest.subject, ' + (now.getFullYear() + '/' + (now.getMonth() + 1) + '/' + now.getDate()) + ']]', username: userObj.username, userslug: userObj.userslug, - url: nconf.get('url'), - site_title: meta.config.title || meta.config.browserTitle || 'NodeBB', notifications: notifications, recent: data.topics, interval: data.interval, diff --git a/src/user/email.js b/src/user/email.js index 734e247eb1..9c61211d9a 100644 --- a/src/user/email.js +++ b/src/user/email.js @@ -102,7 +102,6 @@ UserEmail.sendValidationEmail = function (uid, options, callback) { var title = meta.config.title || meta.config.browserTitle || 'NodeBB'; translator.translate('[[email:welcome-to, ' + title + ']]', meta.config.defaultLang, function (subject) { var data = { - site_title: title, username: username, confirm_link: confirm_link, confirm_code: confirm_code, diff --git a/src/user/reset.js b/src/user/reset.js index 438d629225..2aaa1d76bb 100644 --- a/src/user/reset.js +++ b/src/user/reset.js @@ -85,7 +85,6 @@ UserReset.send = function (email, callback) { function (subject, code, next) { var reset_link = nconf.get('url') + '/reset/' + code; emailer.send('reset', uid, { - site_title: (meta.config.title || 'NodeBB'), reset_link: reset_link, subject: subject, template: 'reset', diff --git a/src/views/emails/welcome.tpl b/src/views/emails/welcome.tpl index 3ac45b06cd..6f126a7754 100644 --- a/src/views/emails/welcome.tpl +++ b/src/views/emails/welcome.tpl @@ -173,12 +173,22 @@ + + + + + +
+ alt_text +
+ + - @@ -186,7 +196,7 @@ -
+ alt_text
+