Use new alertmonitorfl Gmail addy to send email on any message that includes 'alert', closes issue #10
This commit is contained in:
parent
3cdf7ac643
commit
058152aca4
26
server.js
26
server.js
@ -11,15 +11,15 @@ var logfile = fs.createWriteStream('./db/log.log', {flags: 'a'});
|
||||
var transporter = nodemailer.createTransport({
|
||||
service: 'Gmail',
|
||||
auth: {
|
||||
user: 'jkU8K5lrog9w@gmail.com',
|
||||
pass: 'NSLQZ~d6Zb~LLv8#t'
|
||||
user: 'alertmonitorfl@gmail.com',
|
||||
pass: '6g*hkvVc%91oo3#$'
|
||||
}
|
||||
});
|
||||
var mailOptions = {
|
||||
from: 'Alert Monitor <jkU8K5lrog9w@gmail.com>',
|
||||
from: 'Alert Monitor <alertmonitorfl@gmail.com>',
|
||||
to: 'jody@kaplon.us',
|
||||
subject: 'Alert received',
|
||||
text: 'test alert'
|
||||
text: 'test alert' // Get custom text in here with device info.
|
||||
};
|
||||
|
||||
|
||||
@ -117,14 +117,16 @@ app.post('/', function(req, res){
|
||||
);
|
||||
stmt.finalize();
|
||||
|
||||
// Emails were working...don't need to send on every POST anymore.
|
||||
//transporter.sendMail(mailOptions, function(error, info){
|
||||
//if(error){
|
||||
//console.log(error);
|
||||
//}else{
|
||||
//console.log('Message sent: ' + info.response);
|
||||
//}
|
||||
//});
|
||||
// Send emails on alerts only
|
||||
if(JSON.stringify(req.body, null, 4).indexOf('alert') > -1){
|
||||
transporter.sendMail(mailOptions, function(error, info){
|
||||
if(error){
|
||||
console.log(error);
|
||||
}else{
|
||||
console.log('Message sent: ' + info.response);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//res.send(JSON.stringify(req.body, null, 4));
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user