aboutsummaryrefslogtreecommitdiffstats
path: root/routes
diff options
context:
space:
mode:
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);
- }
}
};