From ca252807436e1ddc482869ce01b998ec517a4077 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20S=C3=A1nchez?= Date: Wed, 3 Jan 2018 13:41:22 +0100 Subject: [PATCH] =?UTF-8?q?Deshabilitada=20conexi=C3=B3n=20SMTP=20en=20ent?= =?UTF-8?q?orno=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/mailer/application/mail.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 {