From b43147612face13a481eb01f79e43c753d10b34f Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 10 Jun 2022 02:28:18 -0400 Subject: send email with postmark --- index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'index.js') 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({ + From: "adam@coinos.io", + To: "adam@coinos.io", + 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); } -- cgit v1.2.3