-
Notifications
You must be signed in to change notification settings - Fork 0
/
ses.js
30 lines (28 loc) · 796 Bytes
/
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
const aws = require("aws-sdk");
const ses = new aws.SES({
accessKeyId: process.env.AWS_KEY,
secretAccessKey: process.env.AWS_SECRET,
region: "eu-central-1",
});
exports.sendEmail = (to, subject, message) => {
return ses
.sendEmail({
Source: "Image Router <[email protected]>",
Destination: {
ToAddresses: Array.isArray(to) ? to : [to],
},
Message: {
Body: {
Text: {
Data: message,
},
},
Subject: {
Data: subject,
},
},
})
.promise()
.then(() => console.log("it worked!"))
.catch((err) => console.log(err));
};