Skip to content

Instantly share code, notes, and snippets.

@jordangraft
Created April 24, 2016 19:38
Show Gist options
  • Save jordangraft/7506839ddb79bb52c72f5e44e24d219b to your computer and use it in GitHub Desktop.
Save jordangraft/7506839ddb79bb52c72f5e44e24d219b to your computer and use it in GitHub Desktop.
var AWS = require('aws-sdk');
var https = require('https');
exports.handler = function(event, context) {
var sesNotification = event.Records[0].ses;
var messageId = sesNotification.mail.messageId;
var receipt = sesNotification.receipt;
var from = sesNotification.mail.commonHeaders.from[0];
var appUrl = 'https://www.example.com'
var options = {
host: 'www.example.com',
port: 443,
path: '/emails/incoming?token=test_token&message_id=' + messageId,
method: 'POST',
headers: {}
};
console.log('message ID', messageId);
var req = https.request(options, function(res) {
context.succeed();
console.log('STATUS: ' + res.statusCode);
res.on('data', function(chunk) {
console.log('BODY: ' + chunk);
});
}).on('error', function(e) {
console.log('FAILIRE: ' + e.message)
context.done(null, 'FAILURE');
});
req.end();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment