``` const personalizations = [{ to: [{ email: to }], }]; const msg = {

      const personalizations = [{
          to: [{ email: to }],
        }];
      const msg = {
      personalizations,
      from: {
        email: fromAddress,
        name: fromName,
      },
      subject: subject,
      content: [{ type: "text/plain", value: plainText }],
    };
    const email = await fetch("https://api.sendgrid.com/v3/mail/send", {
      body: JSON.stringify(msg),
      headers: {
        Authorization: `Bearer ${env.SENDGRID_API_KEY}`,
        "Content-Type": "application/json",
      },
      method: "POST",
    });


Sorry if this looks clunky, it's picked straight out of my code. There's a bunch of things going on before the email gets sent.
Was this page helpful?