diff --git a/public/images/emails/banneduser.png b/public/images/emails/banneduser.png new file mode 100644 index 0000000000..4eac70d8ca Binary files /dev/null and b/public/images/emails/banneduser.png differ diff --git a/public/images/emails/digestheader.png b/public/images/emails/digestheader.png new file mode 100644 index 0000000000..44ff4dd203 Binary files /dev/null and b/public/images/emails/digestheader.png differ diff --git a/public/images/emails/emailconfirm.png b/public/images/emails/emailconfirm.png new file mode 100644 index 0000000000..d066015bd9 Binary files /dev/null and b/public/images/emails/emailconfirm.png differ diff --git a/public/images/emails/invitation.png b/public/images/emails/invitation.png new file mode 100644 index 0000000000..283372c9fa Binary files /dev/null and b/public/images/emails/invitation.png differ diff --git a/public/images/emails/newtopic.png b/public/images/emails/newtopic.png new file mode 100644 index 0000000000..bc5718563a Binary files /dev/null and b/public/images/emails/newtopic.png differ diff --git a/public/images/emails/nodebb.png b/public/images/emails/nodebb.png new file mode 100644 index 0000000000..9cfe1cd70c Binary files /dev/null and b/public/images/emails/nodebb.png differ diff --git a/public/images/emails/password.png b/public/images/emails/password.png new file mode 100644 index 0000000000..7a7358e082 Binary files /dev/null and b/public/images/emails/password.png differ diff --git a/public/images/emails/triangularbackground.png b/public/images/emails/triangularbackground.png new file mode 100644 index 0000000000..c47ad51810 Binary files /dev/null and b/public/images/emails/triangularbackground.png differ diff --git a/public/images/emails/unreadpost.png b/public/images/emails/unreadpost.png new file mode 100644 index 0000000000..8228478618 Binary files /dev/null and b/public/images/emails/unreadpost.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..f607edd9c2 100644 --- a/src/topics/follow.js +++ b/src/topics/follow.js @@ -259,13 +259,10 @@ 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, topicSlug: postData.topic.slug, - postCount: postData.topic.postcount, - base_url: nconf.get('url'), + showUnsubscribe: true, }, next); } else { winston.debug('[topics.notifyFollowers] uid ' + toUid + ' does not have post notifications enabled, skipping.'); 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/invite.js b/src/user/invite.js index 3e6fdef359..d3d7189296 100644 --- a/src/user/invite.js +++ b/src/user/invite.js @@ -85,6 +85,9 @@ module.exports = function (User) { template: 'invitation', }; + // Append default data to this email payload + data = Object.assign({}, emailer._defaultPayload, data); + emailer.sendToEmail('invitation', email, meta.config.defaultLang, data, next); }); }, 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/banned.tpl b/src/views/emails/banned.tpl index 2384fe1549..db8975c993 100644 --- a/src/views/emails/banned.tpl +++ b/src/views/emails/banned.tpl @@ -1,18 +1,53 @@ -

- [[email:banned.text1, {username}, {site_title}]] - - [[email:banned.text2, {until}]] - -

+ - -

- [[email:banned.text3]] -

+ + -

- {reason} -

- + + + + + - \ No newline at end of file + + + + + + +
+ +
+ + + + + + + + + + + + +
+

[[email:greeting_with_name, {username}]]

+

+ [[email:banned.text1, {username}, {site_title}]] + +

[[email:banned.text2, {until}]] + +

+
+

+ [[email:banned.text3]] +

{reason} +

+
+

[[email:closing]]

+

{site_title}

+
+
+ + + diff --git a/src/views/emails/digest.tpl b/src/views/emails/digest.tpl index 23d20a89c9..24692949cb 100644 --- a/src/views/emails/digest.tpl +++ b/src/views/emails/digest.tpl @@ -1,50 +1,93 @@ -

[[email:greeting_with_name, {username}]],

+ - -

[[email:digest.notifications, {site_title}]]

+ + - + + + + + -
- + + + + + -

[[email:digest.latest_topics, {site_title}]]

- - -

- [[email:digest.cta, {site_title}]] -

+
+ +
+ + + + + + + + + + + + + + + + + + +
+

[[email:greeting_with_name, {username}]],

+
+

[[email:digest.notifications, {site_title}]]

+ +
+

[[email:digest.latest_topics, {site_title}]]

+ +
+ + + + + +
+ +     [[email:digest.cta, {site_title}]]     + +
+ +
+

[[email:closing]]

+

{site_title}

+
+
+ - -
-

- [[email:digest.unsub.info]] [[email:unsub.cta]]. -

\ No newline at end of file diff --git a/src/views/emails/invitation.tpl b/src/views/emails/invitation.tpl index 1b574dde08..da800eebdb 100644 --- a/src/views/emails/invitation.tpl +++ b/src/views/emails/invitation.tpl @@ -1,11 +1,53 @@ -

[[email:greeting_no_name]],

+ -

- [[email:invitation.text1, {username}, {site_title}]] -

+ + -
- [[email:invitation.ctr]] -
+ + + + + - \ No newline at end of file + + + + + + +
+ +
+ + + + + + + + + + +
+

[[email:greeting_no_name]]

+

[[email:invitation.text1, {username}, {site_title}]]

+
+ + + + + +
+ +     [[email:invitation.ctr]]     + +
+ +
+

[[email:closing]]

+

{site_title}

+
+
+ + + diff --git a/src/views/emails/notif_chat.tpl b/src/views/emails/notif_chat.tpl index f1d5a5fc42..275a5bf782 100644 --- a/src/views/emails/notif_chat.tpl +++ b/src/views/emails/notif_chat.tpl @@ -1,13 +1,58 @@ -

[[email:greeting_with_name, {username}]],

+ -

{summary}:

-
{message.content}
+ + -[[email:notif.chat.cta]] + + + + + - + + + + + + +
+ +
+ + + + + + + + + + + + + +
+

[[email:greeting_with_name, {username}]],

+

{summary}:

+
+ {message.content} +
+ + + + + +
+ +     [[email:notif.chat.cta]]     + +
+ +
+

[[email:closing]]

+

{site_title}

+
+
+ -
-

- [[email:notif.chat.unsub.info]] [[email:unsub.cta]]. -

\ No newline at end of file + diff --git a/src/views/emails/notif_post.tpl b/src/views/emails/notif_post.tpl index 4fd360575f..a7d20aaf83 100644 --- a/src/views/emails/notif_post.tpl +++ b/src/views/emails/notif_post.tpl @@ -1,13 +1,57 @@ -

[[email:greeting_with_name, {username}]],

+ -

{intro}:

-
{postBody}
+ + -[[email:notif.post.cta]] + + + + + - + + + + + + +
+ +
+ + + + + + + + + + + + + +
+

{intro}

+
+ {postBody} +
+ + + + + +
+ +     [[email:notif.post.cta]]     + +
+ +
+

[[email:closing]]

+

{site_title}

+
+
+ -
-

- [[email:notif.post.unsub.info]] [[email:unsub.cta]]. -

+ diff --git a/src/views/emails/partials/footer.tpl b/src/views/emails/partials/footer.tpl index 256a850914..23a9371134 100644 --- a/src/views/emails/partials/footer.tpl +++ b/src/views/emails/partials/footer.tpl @@ -1,4 +1,25 @@ -

- [[email:closing]]
- {site_title} -

\ No newline at end of file + + + + + +
+

+ + [[email:notif.post.unsub.info]] [[email:unsub.cta]]. + +

+
+ + + + + + + + + \ No newline at end of file diff --git a/src/views/emails/partials/header.tpl b/src/views/emails/partials/header.tpl new file mode 100644 index 0000000000..fd94ab4294 --- /dev/null +++ b/src/views/emails/partials/header.tpl @@ -0,0 +1,179 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + + + + +
+ {site_title} +
+ \ No newline at end of file diff --git a/src/views/emails/registration_accepted.tpl b/src/views/emails/registration_accepted.tpl index c025be0330..879104f473 100644 --- a/src/views/emails/registration_accepted.tpl +++ b/src/views/emails/registration_accepted.tpl @@ -1,9 +1,39 @@ -

[[email:greeting_with_name, {username}]],

+ -

- [[email:welcome.text1, {site_title}]] -

+ + -

[[email:welcome.text3]]

+ + + + + - \ No newline at end of file + + + + + + +
+ +
+ + + + + + + +
+

[[email:greeting_with_name, {username}]],

+

[[email:welcome.text1, {site_title}]]

+

[[email:welcome.text3]]

+
+

[[email:closing]]

+

{site_title}

+
+
+ + + diff --git a/src/views/emails/reset.tpl b/src/views/emails/reset.tpl index 7e71d067a5..fd981c3b1e 100644 --- a/src/views/emails/reset.tpl +++ b/src/views/emails/reset.tpl @@ -1,11 +1,54 @@ -

[[email:greeting_no_name]],

+ -

[[email:reset.text1]]

+ + -

[[email:reset.text2]]

+ + + + + -
- [[email:reset.cta]] -
+ + + + + - \ No newline at end of file +
+ +
+ + + + + + + + + + +
+

[[email:greeting_no_name]],

+

[[email:reset.text1]]

+

[[email:reset.text2]]

+
+ + + + + +
+ +     [[email:reset.cta]]     + +
+ +
+

[[email:closing]]

+

{site_title}

+
+
+ + + diff --git a/src/views/emails/reset_notify.tpl b/src/views/emails/reset_notify.tpl index 0a825d3c31..1758035729 100644 --- a/src/views/emails/reset_notify.tpl +++ b/src/views/emails/reset_notify.tpl @@ -1,7 +1,39 @@ -

[[email:greeting_with_name, {username}]],

+ -

[[email:reset.notify.text1, {date}]]

+ + -

[[email:reset.notify.text2]]

+ + + + + - \ No newline at end of file + + + + + + +
+ +
+ + + + + + + +
+

[[email:greeting_with_name, {username}]],

+

[[email:reset.notify.text1, {date}]]

+

[[email:reset.notify.text2]]

+
+

[[email:closing]]

+

{site_title}

+
+
+ + + diff --git a/src/views/emails/test.tpl b/src/views/emails/test.tpl index 75c1519ea1..d777eafc10 100644 --- a/src/views/emails/test.tpl +++ b/src/views/emails/test.tpl @@ -1,5 +1,38 @@ -

[[email:greeting_no_name]],

+ -

[[email:test.text1]]

+ + - \ No newline at end of file + + + + + + + + + + + + +
+ +
+ + + + + + + +
+

[[email:greeting_no_name]],

+

[[email:test.text1]]

+
+

[[email:closing]]

+

{site_title}

+
+
+ + + diff --git a/src/views/emails/welcome.tpl b/src/views/emails/welcome.tpl index c7a78c9056..5fd1311c67 100644 --- a/src/views/emails/welcome.tpl +++ b/src/views/emails/welcome.tpl @@ -1,13 +1,53 @@ -

[[email:greeting_with_name, {username}]],

+ -

- [[email:welcome.text1, {site_title}]] -

+ + -

[[email:welcome.text2]]

+ + + + + -
- [[email:welcome.cta]] -
+ + + + + - \ No newline at end of file +
+ +
+ + + + + + + + + + +
+

[[email:welcome.text1, {site_title}]]

+

[[email:welcome.text2]]

+
+ + + + + +
+ +     [[email:welcome.cta]]     + +
+ +
+

[[email:closing]]

+

{site_title}

+
+
+ + +