mirror of
https://github.com/nestriness/nestri.git
synced 2025-12-13 01:05:37 +02:00
fix: Move more directories
This commit is contained in:
36
cloud/packages/core/src/email/index.ts
Normal file
36
cloud/packages/core/src/email/index.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { Resource } from "sst";
|
||||
import { SESv2Client, SendEmailCommand } from "@aws-sdk/client-sesv2";
|
||||
|
||||
export namespace Email {
|
||||
export const Client = new SESv2Client({});
|
||||
|
||||
export async function send(
|
||||
from: string,
|
||||
to: string,
|
||||
subject: string,
|
||||
body: string,
|
||||
) {
|
||||
from = from + "@" + Resource.Email.sender;
|
||||
console.log("sending email", subject, from, to);
|
||||
await Client.send(
|
||||
new SendEmailCommand({
|
||||
Destination: {
|
||||
ToAddresses: [to],
|
||||
},
|
||||
Content: {
|
||||
Simple: {
|
||||
Body: {
|
||||
Text: {
|
||||
Data: body,
|
||||
},
|
||||
},
|
||||
Subject: {
|
||||
Data: subject,
|
||||
},
|
||||
},
|
||||
},
|
||||
FromEmailAddress: `Nestri <${from}>`,
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user