aboutsummaryrefslogtreecommitdiffstats
path: root/routes/email.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-01-16 23:40:25 -0800
committerAdam Soltys <[email protected]>2023-01-16 23:40:25 -0800
commit91e847126c832efa25ab0bf8d6f3b7e537378fa7 (patch)
tree4a42b6e3bec6eb0f640ed44533b54e6d3d6a5e0e /routes/email.js
parent6bafea9bffe24d2227d269812a73a9a513d92ddf (diff)
downloadcoinos-server-91e847126c832efa25ab0bf8d6f3b7e537378fa7.tar.gz
coinos-server-91e847126c832efa25ab0bf8d6f3b7e537378fa7.zip
shuffle things around
Diffstat (limited to 'routes/email.js')
-rw-r--r--routes/email.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/routes/email.js b/routes/email.js
new file mode 100644
index 00000000..529307e6
--- /dev/null
+++ b/routes/email.js
@@ -0,0 +1,24 @@
+import config from "$config";
+
+export default {
+ async send({ body }, res) {
+ try {
+ let postmark = await import("postmark");
+ let client = new postmark.ServerClient(config.postmark);
+
+ await client.sendEmail({
+ Subject: body.subject || "Email Signup",
+ HtmlBody: JSON.stringify(body),
+ TextBody: JSON.stringify(body),
+ MessageStream: "outbound"
+ });
+
+ res.send({ ok: true });
+ } catch (e) {
+ console.log("problem sending email", e);
+ res.code(500).send(e.message);
+ }
+ }
+};