Created
April 24, 2016 19:38
-
-
Save jordangraft/7506839ddb79bb52c72f5e44e24d219b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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