From a749972cf93fd021dda11389753ae4985ff61b42 Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Sun, 9 Feb 2020 02:55:29 +0100 Subject: [PATCH] Fix email formatting (I think) --- server/models/User.js | 2 +- server/routes/users.js | 4 ++-- server/utils/mailer.js | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/server/models/User.js b/server/models/User.js index bd7e8edc..70d8b521 100644 --- a/server/models/User.js +++ b/server/models/User.js @@ -135,7 +135,7 @@ const UserModel = { const subject = "vchess.club - notification"; const body = "Hello " + user.name + "!" + ` - ` + message; +` + message; sendEmail(params.mail.noreply, user.email, subject, body); }, diff --git a/server/routes/users.js b/server/routes/users.js index e685a57d..0302b1c0 100644 --- a/server/routes/users.js +++ b/server/routes/users.js @@ -52,10 +52,10 @@ function setAndSendLoginToken(subject, to, res) return res.json({errmsg: err.toString()}); const body = "Hello " + to.name + "!" + ` - ` + +` + "Access your account here: " + params.siteURL + "/#/authenticate/" + token + ` - ` + +` + "Token will expire in " + params.token.expire/(1000*60) + " minutes." sendEmail(params.mail.noreply, to.email, subject, body, err => { res.json(err || {}); diff --git a/server/utils/mailer.js b/server/utils/mailer.js index 9d3ea302..60cc9f26 100644 --- a/server/utils/mailer.js +++ b/server/utils/mailer.js @@ -8,8 +8,7 @@ module.exports = function(from, to, subject, body, cb) { console.log("New mail: from " + from + " / to " + to); console.log("Subject: " + subject); - let msgText = body.split('\\n'); - msgText.forEach(msg => { console.log(msg); }); + console.log(body); if (!cb) cb = (err) => { if (!!err) console.log(err); } return cb(); -- 2.44.0