Deshabilitada conexión SMTP en entorno test
This commit is contained in:
parent
492902e637
commit
ca25280743
|
@ -12,6 +12,8 @@ module.exports = {
|
||||||
* Load mail config.
|
* Load mail config.
|
||||||
*/
|
*/
|
||||||
init: function() {
|
init: function() {
|
||||||
|
if (process.env.NODE_ENV == 'test')
|
||||||
|
return;
|
||||||
|
|
||||||
this.transporter = nodemailer.createTransport(config.smtp);
|
this.transporter = nodemailer.createTransport(config.smtp);
|
||||||
|
|
||||||
|
@ -35,6 +37,9 @@ module.exports = {
|
||||||
* @param {Object} cb - Callback
|
* @param {Object} cb - Callback
|
||||||
*/
|
*/
|
||||||
send: function(recipient, subject, body, attachments, params, cb) {
|
send: function(recipient, subject, body, attachments, params, cb) {
|
||||||
|
if (process.env.NODE_ENV == 'test')
|
||||||
|
return;
|
||||||
|
|
||||||
let mailOptions = {
|
let mailOptions = {
|
||||||
from: '"' + config.app.senderName + '" <' + config.app.senderMail + '>',
|
from: '"' + config.app.senderName + '" <' + config.app.senderMail + '>',
|
||||||
to: recipient,
|
to: recipient,
|
||||||
|
@ -43,9 +48,8 @@ module.exports = {
|
||||||
attachments
|
attachments
|
||||||
};
|
};
|
||||||
|
|
||||||
if (config.app.debug) {
|
if (process.env.NODE_ENV != 'production')
|
||||||
mailOptions.to = config.smtp.testEmail;
|
mailOptions.to = config.smtp.testEmail;
|
||||||
}
|
|
||||||
|
|
||||||
this.transporter.sendMail(mailOptions, (error, info) => {
|
this.transporter.sendMail(mailOptions, (error, info) => {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue