-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathses.js
46 lines (42 loc) · 1.07 KB
/
ses.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Load the AWS SDK for Node.js
var AWS = require('aws-sdk');
// Set the region
// Create sendEmail params
var params = {
Destination: { /* required */
CcAddresses: [
/* more items */
],
ToAddresses: [
/* more items */
]
},
Message: { /* required */
Body: { /* required */
Html: {
Charset: "UTF-8",
Data:
},
},
Subject: {
Charset: 'UTF-8',
Data: 'Test email'
}
},
Source: 'SENDER_EMAIL_ADDRESS', /* required */
ReplyToAddresses: [
'EMAIL_ADDRESS',
/* more items */
],
};
// Create the promise and SES service object
var sendPromise = new AWS.SES({ apiVersion: '2010-12-01' }).sendEmail(params).promise();
// Handle promise's fulfilled/rejected states
sendPromise.then(
function (data) {
console.log(data.MessageId);
}).catch(
function (err) {
console.error(err, err.stack);
});