aboutsummaryrefslogtreecommitdiffstats
path: root/index.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2022-06-10 02:28:18 -0400
committerAdam Soltys <[email protected]>2022-06-10 02:29:18 -0400
commitb43147612face13a481eb01f79e43c753d10b34f (patch)
treed877eedf68b464efc7c8110925126fb743a8bbc9 /index.js
parentc1dff6b22b1e9659943be4ab98b9e0c06e4b11e2 (diff)
downloadcoinos-server-b43147612face13a481eb01f79e43c753d10b34f.tar.gz
coinos-server-b43147612face13a481eb01f79e43c753d10b34f.zip
send email with postmark
Diffstat (limited to 'index.js')
-rw-r--r--index.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/index.js b/index.js
index 07576f11..3e0cd436 100644
--- a/index.js
+++ b/index.js
@@ -109,6 +109,27 @@ app.post("/email", async (req, res) => {
let file = persist("data/emails.json");
file.emails = [...file.emails, req.body];
res.send({ ok: true });
+
+ try {
+ // Require:
+ var postmark = require("postmark");
+
+ // Send an email:
+ var client = new postmark.ServerClient(
+ config.postmark
+ );
+
+ client.sendEmail({
+ Subject: "Email Signup",
+ HtmlBody: JSON.stringify(req.body),
+ TextBody: JSON.stringify(req.body),
+ MessageStream: "outbound"
+ });
+ } catch(e) {
+ console.log("problem sending email", e);
+ }
} catch (e) {
console.log(e);
}