X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=server%2Futils%2Fmailer.js;h=b0a0bacef90f69ac18860f409c58342cdbab1f7b;hp=60cc9f26d66974018fc726c90d3888f89bdc069f;hb=866842c3c310524c034922870234120ed2a16cbf;hpb=8477e53d8e78606e4c4e4bf91c77b1011aab583c diff --git a/server/utils/mailer.js b/server/utils/mailer.js index 60cc9f26..b0a0bace 100644 --- a/server/utils/mailer.js +++ b/server/utils/mailer.js @@ -10,10 +10,14 @@ module.exports = function(from, to, subject, body, cb) console.log("Subject: " + subject); 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 @@ -38,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); }); }