email-api icon indicating copy to clipboard operation
email-api copied to clipboard

Send emails using Cloudflare Worker, for free.

Email API for Proselog.

Not intended for use outside of Proselog, but it should work with any worker, without any configuration.

import { sendEmail } from "@proselog/email-api"

const { data, error } = await sendEmail(
  {
    from: { email: "[email protected]", name: "Your Name" },
    to: [{ email: "[email protected]", name: "Customer Name" }],
    content: `
  Hello %%to.name%%

  Use the following token to login: 

  %%token%%
  `,
    data: [{ token: "SOME_TOKEN" }],
  },
  {
    // The token that matches API_TOKEN in your cloudflare worker secrets
    token: "API_TOKEN",
  }
)