diff --git a/services/mailer/application/mail.js b/services/mailer/application/mail.js index 04af6b007..2d3a2c626 100644 --- a/services/mailer/application/mail.js +++ b/services/mailer/application/mail.js @@ -12,6 +12,8 @@ module.exports = { * Load mail config. */ init: function() { + if (process.env.NODE_ENV == 'test') + return; this.transporter = nodemailer.createTransport(config.smtp); @@ -35,6 +37,9 @@ module.exports = { * @param {Object} cb - Callback */ send: function(recipient, subject, body, attachments, params, cb) { + if (process.env.NODE_ENV == 'test') + return; + let mailOptions = { from: '"' + config.app.senderName + '" <' + config.app.senderMail + '>', to: recipient, @@ -43,9 +48,8 @@ module.exports = { attachments }; - if (config.app.debug) { + if (process.env.NODE_ENV != 'production') mailOptions.to = config.smtp.testEmail; - } this.transporter.sendMail(mailOptions, (error, info) => { try {