generated from dsfx3d/generator-ts-workspace
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbin.js
47 lines (44 loc) · 1.26 KB
/
bin.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
47
import {SESClient, SendEmailCommand} from "@aws-sdk/client-ses";
import {getInput} from "@actions/core";
const bcc = getInput("bcc", {required: false});
const body = getInput("body", {required: false});
const bodyHtml = getInput("body_html", {required: false});
const cc = getInput("cc", {required: false});
const from = getInput("from", {required: true});
const replyTo = getInput("reply_to", {required: false});
const subject = getInput("subject", {required: true});
const to = getInput("to", {required: true});
const command = new SendEmailCommand({
Destination: {
ToAddresses: to.split(","),
CcAddresses: cc ? cc.split(",") : undefined,
BccAddresses: bcc ? bcc.split(",") : undefined,
},
Message: {
Subject: {
Data: subject,
Charset: "utf8",
},
Body: {
Text: {
Data: body,
Charset: "utf8",
},
Html: {
Data: bodyHtml,
Charset: "utf8",
},
},
},
Source: from,
ReplyToAddresses: replyTo ? replyTo.split(",") : undefined,
});
export const run = () => {
return new SESClient({
credentials: {
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
},
region: process.env.AWS_DEFAULT_REGION,
}).send(command);
};