Created
October 25, 2012 16:52
-
-
Save tromboneamafone/3953992 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//email alert for nmt's | |
//need to determine if auctually connected to enrg sql db | |
// | |
//TO-DO: EMAIL http://howtonode.org/sending-e-mails-with-node-and-nodemailer | |
var Connection = require('tedious').Connection, | |
Request = require('tedious').Request, //sql monitering dependency | |
nodemailer = require('nodemailer'); //email dependency | |
var config = { | |
userName: 'baller', | |
password: 'Birdie2', | |
server: '506.enrgnmt.com', | |
}; | |
var connection = new Connection(config); | |
console.log('before connection.on'); | |
//connecting to the db | |
//http://pekim.github.com/tedious/getting-started.html | |
connection.on('connect', function(err) { | |
if(err) { | |
console.log(err); | |
} | |
else { | |
console.log('sucessful connection, now get some data');//why not printing | |
} | |
console.log('inception');//why not printing | |
printData(); | |
}); | |
console.log('after connection.on'); | |
//sql statement execution? | |
//http://pekim.github.com/tedious/getting-started.html | |
function executeStatement() { | |
request = new Request(" | |
} | |
/*emailing WORKS AS IS | |
var smtpTransport = nodemailer.createTransport("SMTP",{ | |
service: "Gmail", | |
auth: { | |
user: "tromboneamafone@gmail.com", | |
pass: "124461rlb!?" | |
} | |
}); | |
var mailOptions = { | |
from: "<robertbevly@gmail.com>", | |
to: "tromboneamafone@gmail.com, tromb_rob67@yahoo.com", | |
subject: "subject goes here", | |
text: "the system is down.", | |
html: "<b>html goes here</b>" | |
} | |
smtpTransport.sendMail(mailOptions, function(error, response) { | |
if(error) { | |
console.log(error); | |
} | |
else { | |
console.log("Message sent: " + response.message); | |
} | |
}); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment