Add function to check SMTP status
This commit is contained in:
14
helpers/logSmtpStatus.js
Normal file
14
helpers/logSmtpStatus.js
Normal file
@@ -0,0 +1,14 @@
|
||||
const transporter = require('./smtpConfig');
|
||||
|
||||
function logSmtpStatus() {
|
||||
transporter.verify(function (error, success) {
|
||||
if (error) {
|
||||
console.log('SMTP is not working, check your configuration.');
|
||||
return ``;
|
||||
} else {
|
||||
console.log('SMTP is correctly configured.');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = logSmtpStatus;
|
||||
@@ -1,15 +0,0 @@
|
||||
const smtpTransporter = require('./smtpTransporter');
|
||||
|
||||
function smtpStatus() {
|
||||
smtpTransporter.verify(function (error, success) {
|
||||
if (error) {
|
||||
console.log(error);
|
||||
return `SMTP is not working, check your configuration.`
|
||||
} else {
|
||||
console.log('Server is ready to take our messages');
|
||||
return `SMTP is correctly configured.`
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = smtpStatus;
|
||||
Reference in New Issue
Block a user