-
-
Save Zohorul/cb5366b9c29d29ba65e92b4cad484e8e to your computer and use it in GitHub Desktop.
Send email with AWS SES in Lambda
This file contains 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
"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