Skip to content

Commit

Permalink
Fix broken transport.verify()
Browse files Browse the repository at this point in the history
- chaining is failing 100%
  • Loading branch information
trasherdk committed Apr 26, 2021
1 parent a402bd1 commit 023f8bb
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/services/email.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,17 @@ const logger = require('../config/logger');
const transport = nodemailer.createTransport(config.email.smtp);
/* istanbul ignore next */
if (config.env !== 'test') {
transport
.verify()
.then(() => logger.info('Connected to email server'))
.catch(() => logger.warn('Unable to connect to email server. Make sure you have configured the SMTP options in .env'));
transport.verify((error, success) => {
switch (true) {
case error:
logger.warn('Unable to connect to email server. Make sure you have configured the SMTP options in .env');
break;
case success:
default:
logger.info('Connected to email server');
break;
}
});
}

/**
Expand Down

0 comments on commit 023f8bb

Please sign in to comment.