Skip to content

Instantly share code, notes, and snippets.

@Zohorul
Forked from diegofcornejo/aws_ses_lambda.js
Created January 22, 2019 04:28
Show Gist options
  • Save Zohorul/cb5366b9c29d29ba65e92b4cad484e8e to your computer and use it in GitHub Desktop.
Save Zohorul/cb5366b9c29d29ba65e92b4cad484e8e to your computer and use it in GitHub Desktop.
Send email with AWS SES in Lambda
"use strict";
const AWS = require('aws-sdk');
const SES = new AWS.SES({ apiVersion: '2010-12-01' });
module.exports = {
send: function() {
var params = {
Destination: {
ToAddresses: [
"[email protected]"
]
},
Message: {
Body: {
Html: {
Charset: "UTF-8",
Data: "Here your Message in <b>HTML</b>"
},
Text: {
Charset: "UTF-8",
Data: "Here your Message in plain text"
}
},
Subject: {
Charset: "UTF-8",
Data: "Here you Subject"
}
},
Source: "[email protected]",
};
SES.sendEmail(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment