Created
February 20, 2019 15:07
-
-
Save questsin/682b1c44a261ca29121716343c412f12 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'); | |
//Policies | |
//AWSLambdaFullAccess | |
//CloudWatchFullAccess | |
//AmazonSESFullAccess | |
//CloudWatchLogsFullAccess | |
exports.handler = (event, context, callback) => { | |
var ses = new AWS.SES({ | |
region: 'us-west-2' | |
}); | |
var params = { | |
Destination: { | |
ToAddresses: ["[email protected]"] | |
}, | |
Message: { | |
Body: { | |
Text: { | |
Charset: "UTF-8", | |
Data: "This is the message body in text format." | |
} | |
}, | |
Subject: { | |
Charset: "UTF-8", | |
Data: "Test email" | |
} | |
}, | |
Source: "[email protected]" | |
}; | |
// Send the email | |
ses.sendEmail(params, function (err, data) { | |
if (err) { | |
console.log(err, err.stack); | |
callback(err, err.stack); | |
} else { | |
console.log(data); // successful response | |
callback(null, data); | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment