aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-11-29 11:47:12 -0800
committerAdam Soltys <[email protected]>2023-11-29 11:47:12 -0800
commitacb93f29e83b35c0917d88ebbc62812e2dff989f (patch)
tree326021e763cf9b013699ce22b67837929fd352e5
parent8c5835fc2ca21fbe0dfd870d932253f24c995b48 (diff)
downloadcoinos-server-acb93f29e83b35c0917d88ebbc62812e2dff989f.tar.gz
coinos-server-acb93f29e83b35c0917d88ebbc62812e2dff989f.zip
disable mail call for now
-rw-r--r--lib/mail.js41
-rw-r--r--lib/payments.js6
2 files changed, 27 insertions, 20 deletions
diff --git a/lib/mail.js b/lib/mail.js
index 1dc72b1f..b5fda14d 100644
--- a/lib/mail.js
+++ b/lib/mail.js
@@ -1,3 +1,4 @@
+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";
@@ -5,29 +6,35 @@ import handlebars from "handlebars";
import fs from "fs";
import path from "path";
+let Charset = "UTF-8";
+
export let templates = {
paymentSent: "templates/payments/sent.html"
};
export let mail = async (user, subject, template, params) => {
- if (!user.email) return;
+ try {
+ if (!user.email) return;
- let source = fs.readFileSync(path.join(__dirname, template), "utf8");
- let html = handlebars.compile(source, params);
+ 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 }
+ 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 }
},
- Subject: { Charset, Data: subject }
- },
- Source: config.support
- })
- );
+ Source: config.support
+ })
+ );
+ } catch (e) {
+ err(e.message);
+ }
};
diff --git a/lib/payments.js b/lib/payments.js
index 510f24e2..9f32f8fb 100644
--- a/lib/payments.js
+++ b/lib/payments.js
@@ -99,9 +99,9 @@ export let debit = async (
l("sent", type, user.username, amount);
emit(user.id, "payment", p);
- mail(user, "Payment sent", templates.paymentSent, {
- username: user.username
- });
+ // mail(user, "Payment sent", templates.paymentSent, {
+ // username: user.username
+ // });
return p;
};