X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=utils%2Fmailer.js;h=8a059da28c8c935a19f7bb64a20a780cd37713ca;hb=b955c65b942d09d24b5c3bed0d755d4f2f8f71f1;hp=c8080b957547b7d2b621b97c93ab50caea3100a1;hpb=0bd5933d97a90473233d0f90f465a43aba430ffa;p=vchess.git diff --git a/utils/mailer.js b/utils/mailer.js index c8080b95..8a059da2 100644 --- a/utils/mailer.js +++ b/utils/mailer.js @@ -3,6 +3,16 @@ const params = require("../config/parameters"); module.exports = function(from, to, subject, body, cb) { + // Avoid the actual sending in development mode + if (params.env === 'development') + { + console.log("New mail: from " + from + " / to " + to); + console.log("Subject: " + subject); + let msgText = body.split('\\n'); + msgText.forEach(msg => { console.log(msg); }); + return cb(); + } + // Create reusable transporter object using the default SMTP transport const transporter = nodemailer.createTransport({ host: params.mail.host, @@ -22,17 +32,6 @@ module.exports = function(from, to, subject, body, cb) text: body, }; - // Avoid the actual sending in development mode - const env = process.env.NODE_ENV || 'development'; - if ('development' === env) - { - console.log("New mail: from " + from + " / to " + to); - console.log("Subject: " + subject); - let msgText = body.split('\\n'); - msgText.forEach(msg => { console.log(msg); }); - return cb(); - } - // Send mail with the defined transport object transporter.sendMail(mailOptions, (error, info) => { if (!!error)