Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.bunny.net/llms.txt

Use this file to discover all available pages before exploring further.

To send an email using Resend, use the resend SDK. Set your Resend API key as an environment secret named RESEND_API_KEY.
import * as BunnySDK from "@bunny.net/edgescript-sdk";
import { Resend } from "https://esm.sh/resend";
import process from "node:process";

const resend = new Resend(process.env.RESEND_API_KEY);

BunnySDK.net.http.serve(async (req) => {
  try {
    await resend.emails.send({
      from: "sender@yourdomain.com",
      to: "recipient@example.com",
      subject: "Welcome to Bunny Edge Scripting!",
      text: "This email was sent directly from the edge.",
    });
    return new Response("Email sent successfully!");
  } catch (error) {
    console.error(error);
    return new Response("Failed to send email.", { status: 500 });
  }
});