Like this? ```ts import PostalMime from "postal-mime"; const parser = new PostalMime(); export def

Like this?
import PostalMime from "postal-mime";

const parser = new PostalMime();

export default <ExportedHandler> {
  async email(msg) {
    const email = await parser.parse(msg);
    await fetch("https://my.webhook.target/id", {
      method: "POST",
      headers: {
        "content-type": "application/json",
      },
      body: JSON.stringify({
        from: email.from,
        subject: email.subject,
        text: email.text,
      }),
    });
  },
};
Was this page helpful?