aboutsummaryrefslogtreecommitdiffstats
path: root/routes
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-02-28 12:08:13 -0800
committerAdam Soltys <[email protected]>2023-02-28 12:08:18 -0800
commite4702b4d13e4d966d735c2ba4657e10d7c436a57 (patch)
treea38b7f1f3e0089159eec87131cb9d575e59297df /routes
parent80fe35caae77ab6551c35f340a18007e2bfb9750 (diff)
downloadcoinos-server-e4702b4d13e4d966d735c2ba4657e10d7c436a57.tar.gz
coinos-server-e4702b4d13e4d966d735c2ba4657e10d7c436a57.zip
switch to sendgrid
Diffstat (limited to 'routes')
-rw-r--r--routes/email.js26
1 files changed, 10 insertions, 16 deletions
diff --git a/routes/email.js b/routes/email.js
index 529307e6..05f682af 100644
--- a/routes/email.js
+++ b/routes/email.js
@@ -1,24 +1,18 @@
import config from "$config";
+import sendgrid from "@sendgrid/mail";
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"
- });
+ sendgrid.setApiKey(config.sendgrid);
+ const msg = {
+ subject: body.subject || "Email Signup",
+ text: JSON.stringify(body),
+ html: JSON.stringify(body)
+ };
+ await sendgrid.send(msg);
res.send({ ok: true });
- } catch (e) {
- console.log("problem sending email", e);
- res.code(500).send(e.message);
- }
}
};