X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=server%2Futils%2Fmailer.js;h=b0a0bacef90f69ac18860f409c58342cdbab1f7b;hb=866842c3c310524c034922870234120ed2a16cbf;hp=9d3ea3024182c3a6019c8cb99b540e0e1ecff648;hpb=fe4c7e67075416c48aafe9e307bef5afea7937bc;p=vchess.git diff --git a/server/utils/mailer.js b/server/utils/mailer.js index 9d3ea302..b0a0bace 100644 --- a/server/utils/mailer.js +++ b/server/utils/mailer.js @@ -8,13 +8,16 @@ 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(); + cb = (err) => { if (err) console.log(err); } + cb(); + return; } - else if (!cb) + + // Production-only code from here: + + if (!cb) cb = () => {}; //default: do nothing (TODO: log somewhere) // Create reusable transporter object using the default SMTP transport @@ -39,10 +42,8 @@ module.exports = function(from, to, subject, body, cb) // Send mail with the defined transport object transporter.sendMail(mailOptions, (error, info) => { - if (!!error) - return cb(error); // Ignore info. Option: //console.log('Message sent: %s', info.messageId); - return cb(); + cb(error); }); }