Skip to content

Instantly share code, notes, and snippets.

@questsin
Created February 20, 2019 15:07
Show Gist options
  • Save questsin/682b1c44a261ca29121716343c412f12 to your computer and use it in GitHub Desktop.
Save questsin/682b1c44a261ca29121716343c412f12 to your computer and use it in GitHub Desktop.
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