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 });
}
});
To send an email using SendGrid, use the @sendgrid/mail SDK. Set your SendGrid API key as an environment secret named SENDGRID_API_KEY.import * as BunnySDK from "@bunny.net/edgescript-sdk";
import sgMail from "https://esm.sh/@sendgrid/mail";
import process from "node:process";
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
BunnySDK.net.http.serve(async (req) => {
const msg = {
to: "recipient@example.com",
from: "sender@yourdomain.com",
subject: "Welcome to Bunny Edge Scripting!",
text: "This email was sent directly from the edge.",
};
try {
await sgMail.send(msg);
return new Response("Email sent successfully!");
} catch (error) {
console.error(error);
return new Response("Failed to send email.", { status: 500 });
}
});