All frameworks
Send Email from Bun
Send emails from Bun with blazing speed
1
Install the SDK
bun add sendpigeon2
Set your API key
SENDPIGEON_API_KEY=your_api_key_hereGet your API key from the dashboard.
3
Send your first email
typescriptimport { SendPigeon } from "sendpigeon";
const client = new SendPigeon(Bun.env.SENDPIGEON_API_KEY!);
Bun.serve({
port: 3000,
async fetch(req) {
if (req.method === "POST" && new URL(req.url).pathname === "/contact") {
const { email, name } = await req.json();
await client.emails.send({
from: "hello@yourdomain.com",
to: email,
subject: `Thanks for reaching out, ${name}!`,
html: `<h1>We got your message</h1><p>We'll get back to you soon.</p>`,
});
return Response.json({ success: true });
}
return new Response("Not found", { status: 404 });
},
});Why use SendPigeon with Bun?
- Fastest JavaScript runtime
- Drop-in Node.js replacement
- Built-in TypeScript
- 99.9% deliverability with dedicated IPs
- Real-time analytics and webhook events
🧪
Testing locally? Use our local email server to catch emails without sending real ones.
🎨
Prefer visual editing? Build email templates with our free drag-and-drop builder. Learn more →
Ready to send emails from Bun?
Start free with 3,000 emails/month. No credit card required.
Get Started Free