aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mail.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mail.js')
-rw-r--r--lib/mail.js44
1 files changed, 0 insertions, 44 deletions
diff --git a/lib/mail.js b/lib/mail.js
deleted file mode 100644
index 16b3dbbf..00000000
--- a/lib/mail.js
+++ /dev/null
@@ -1,44 +0,0 @@
-import { l, err, warn } from "$lib/logging";
-import config from "$config";
-import { SESClient } from "@aws-sdk/client-ses";
-import { SendEmailCommand } from "@aws-sdk/client-ses";
-import handlebars from "handlebars";
-import fs from "fs";
-import path from "path";
-
-let Charset = "UTF-8";
-
-export let templates = {
- verifyEmail: "templates/payments/verify.html",
- paymentReceived: "templates/payments/received.html",
- passwordReset: "templates/payments/reset.html",
-};
-
-export let mail = async (user, subject, template, params) => {
- try {
- l("sending mail", user.username, subject);
- if (!user.email) return;
-
- let source = fs.readFileSync(template, "utf8");
- let html = handlebars.compile(source)(params);
-
- let client = new SESClient({ region: "us-east-2" });
-
- await client.send(
- new SendEmailCommand({
- Destination: {
- ToAddresses: [user.email],
- },
- Message: {
- Body: {
- Html: { Charset, Data: html },
- },
- Subject: { Charset, Data: subject },
- },
- Source: `"Coinos " <${config.support}>`,
- }),
- );
- } catch (e) {
- err("failed to send email", e.message);
- }
-};