work on it

This commit is contained in:
typpo 2012-04-06 15:44:51 -04:00
parent b33c5bb0e8
commit 5fe11eaf0b
2 changed files with 19 additions and 6 deletions

23
app.js
View File

@ -26,30 +26,43 @@ app.get('/', function(req, res) {
});
});
app.post('/text', function(req, res) {
if (true) {
sendText(req.body.number, req.body.msg, function(err) {
if (err)
res.send({success:false});
else
res.send({success:true});
});
}
});
function sendText(phone, msg, cb) {
var transport = nodemailer.createTransport("SES", {
AWSAccessKeyID: config.aws.access,
AWSSecretKey: config.aws.secret,
AWSSecretKey: config.aws.secret,
});
var mailOptions = {
transport: transport, // transport method to use
from: "testing@airtext.com", // sender address
from: "txt@textbelt.com", // sender address
to: '9147727429@vtext.com',
subject: '', // Subject line
text: 'testtingg', // plaintext body
text: msg,
}
nodemailer.sendMail(mailOptions, function(error){
if (error) {
console.log(error);
cb(true);
}
else {
console.log("Message sent!");
cb();
cb(false);
}
transport.close(function(){}); // shut down the connection pool
});
}
var port = process.env.PORT || 8080;
app.listen(port, function() {

View File

@ -1,5 +1,5 @@
{
"name": "AirText"
"name": "TextBelt"
, "dependencies": {
"express": "2.5.2"
, "jade": "0.14.2"