Last active
July 30, 2017 18:20
-
-
Save compmonks/cd628e38750ddad44ca614976ac56478 to your computer and use it in GitHub Desktop.
node-mandrill tests
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
// directory | |
// | |
// public(folder) | |
// --app.js | |
// --js(folder) | |
// ----form.js | |
// app.js | |
var express = require('express'); | |
var mandrill = require('node-mandrill')('API_KEY'); | |
var req = require('request'); | |
var app = express(); | |
app.use(express.static('public')); | |
app.post('/sendEmail',function(req,res){ | |
mandrill('/messages/send', { | |
message: { | |
to: EMAIL, | |
from: [{email: req.email , name: req.name}], | |
subject: req.subject, | |
text: req.message | |
} | |
}, function(error, response){ | |
if (error) console.log( error ); | |
else console.log(response); | |
}); | |
}); | |
app.listen(15187); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment