--- a/controllers/emailer.js
+++ b/controllers/emailer.js
@@ -2,13 +2,17 @@
//Emailer to sendEmail
-var email=require('nodemailer');
+var email = require('nodemailer');
var emailconfig = require('../config/email');
-var emailbody = require('../signature');
+var emailbody = require('../signature');
+var logger = require('../config/logger.js');
+
+var handler = "backend.controllers.emailer";
var transporter= email.createTransport({
- service: 'hotmail',
- port: 465,
+ host: "smtp-mail.outlook.com",
+ secureConnection: false,
+ port: 587,
auth: {
type: 'OAuth2',
user: emailconfig.userEmail,
@@ -30,9 +34,11 @@
transporter.sendMail(mailOptions, function(error,info){
if(error){
- console.log(error);
+ logger.error(handler, error);
+ //console.log(error);
} else {
- console.log('Email sent: '+ info.response);
+ logger.info(handler, info.response);
+ //console.log('Email sent: '+ info.response);
}
});
}
@@ -47,10 +53,11 @@
transporter.sendMail(mailOptions, function(error,info){
if(error){
- console.log(error);
+ logger.error(handler, error);
+ //console.log(error);
} else {
- console.log('Email sent: '+ info.response);
+ logger.info(handler, info.response);
+ //console.log('Email sent: '+ info.response);
}
});
-}
-
+}