From: Benjamin Auder Date: Sun, 9 Feb 2020 01:55:29 +0000 (+0100) Subject: Fix email formatting (I think) X-Git-Url: https://git.auder.net/variants/img/pieces/doc/current/scripts/%24%7BgetWhatsApp%28link%29%7D?a=commitdiff_plain;h=a749972cf93fd021dda11389753ae4985ff61b42;p=vchess.git Fix email formatting (I think) --- 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();