work on it
This commit is contained in:
parent
b33c5bb0e8
commit
5fe11eaf0b
23
app.js
23
app.js
@ -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() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "AirText"
|
||||
"name": "TextBelt"
|
||||
, "dependencies": {
|
||||
"express": "2.5.2"
|
||||
, "jade": "0.14.2"
|
||||
|
Loading…
Reference in New Issue
Block a user