aboutsummaryrefslogtreecommitdiffstats
path: root/routes/email.js
blob: 05f682af271132c193f1db9663741f49956ae21e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import config from "$config";
import sendgrid from "@sendgrid/mail";

export default {
  async send({ body }, res) {
    sendgrid.setApiKey(config.sendgrid);
    const msg = {
      to: "[email protected]",
      from: "[email protected]",
      subject: body.subject || "Email Signup",
      text: JSON.stringify(body),
      html: JSON.stringify(body)
    };

      await sendgrid.send(msg);
      res.send({ ok: true });
  }
};